add sled
This commit is contained in:
18
sled/src/main.rs
Normal file
18
sled/src/main.rs
Normal 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(())
|
||||
}
|
||||
Reference in New Issue
Block a user