This commit is contained in:
2020-05-20 00:51:50 +08:00
parent 489463ef84
commit b72dc883a7
3 changed files with 249 additions and 0 deletions

18
sled/src/main.rs Normal file
View File

@@ -0,0 +1,18 @@
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(())
}