1 unstable release
Uses old Rust 2015
0.1.0 | May 12, 2016 |
---|
#23 in #lines
9KB
216 lines
string-lines
Raw persistent database for storing string lines.
Example
extern crate string_lines;
use string_lines::StringLines;
fn main() {
let mut lines = StringLines::open(
"target/push_pop.example"
).expect("Unable to open file");
for i in 1..101 {
let line = format!("line {}",i);
let _ = lines.push(&line).expect("Unable to push line");
}
loop {
match lines.pop().expect("Unable to pop line") {
Some(line) => {
println!("{}",line);
},
None => {
break;
}
}
}
}
lib.rs
:
Raw persistent database for storing string lines.
string_lines
is on [Crates.io][string_lines] and [GitHub][github].
Example
use string_lines::StringLines;
let mut lines = StringLines::open(
"target/push_pop.example"
).expect("Unable to open file");
for i in 1..101 {
let line = format!("line {}",i);
let _ = lines.push(&line).expect("Unable to push line");
}
loop {
match lines.pop().expect("Unable to pop line") {
Some(line) => {
println!("{}",line);
},
None => {
break;
}
}
}
Dependencies
~77KB