#line #string #persistent #database

string-lines

用于存储字符串行的原始持久数据库

1 个不稳定版本

使用旧的Rust 2015

0.1.0 2016年5月12日

#15 in #lines

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

9KB
216

string-lines

Build Status Latest Version

API文档

用于存储字符串行的原始持久数据库。

示例

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:

用于存储字符串行的原始持久数据库。

string_lines可在[Crates.io][string_lines]和[GitHub][github]找到。

示例

 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;
		}
	}
}

依赖

~75KB