#line #string #persistent #database

string-lines

Raw persistent database for storing string lines

1 unstable release

Uses old Rust 2015

0.1.0 May 12, 2016

#23 in #lines

AGPL-3.0/GPL-3.0/MIT/Apache-2.0

9KB
216 lines

string-lines

Build Status Latest Version

API Documentation

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