Files
simple-rust-tests/sled/src/main.rs
2020-05-20 00:52:33 +08:00

20 lines
355 B
Rust

// http://sled.rs/
fn main() -> Result<(), Box<dyn std::error::Error>>{
let path = "a.file";
let tree = sled::open(path)?;
let k = "hello";
let v = "world";
// insert and get, similar to std's BTreeMap
tree.insert(k, v)?;
for kv in tree.range(k..) {
println!("kv: {:?}", kv);
}
tree.flush()?;
Ok(())
}