update readme to include delete

master
Tyler Neely 10 years ago
parent 6dbde9d2e9
commit 3287c19668
  1. 5
      README.md
  2. 25
      src/main.rs

@ -22,9 +22,10 @@ fn main() {
println!("retrieved utf8 value {}", v),
None =>
println!("did not read valid utf-8 out of the db"),
}});
}
}).on_absent(|| { println!("value not found") });
db.get(b"NOT my key").on_absent( || { println!("value not found") });
db.delete(b"my key");
db.close();
},

@ -7,23 +7,20 @@ use test::Bencher;
fn main() {
match rocksdb::create_or_open("/tmp/rust-rocksdb".to_string()) {
Ok(db) => {
for i in range(0u, 20) {
spawn(proc() {
db.put(b"my key", b"my value");
db.put(b"my key", b"my value");
db.get(b"my key").map( |value| {
match value.to_utf8() {
Some(v) =>
println!("retrieved utf8 value {}", v),
None =>
println!("did not read valid utf-8 out of the db"),
}});
db.get(b"my key").map( |value| {
match value.to_utf8() {
Some(v) =>
println!("retrieved utf8 value {}", v),
None =>
println!("did not read valid utf-8 out of the db"),
}
}).on_absent(|| { println!("value not found") });
db.get(b"NOT my key").on_absent(|| { println!("value not found") });
db.delete(b"my key");
db.close();
});
}
db.close();
},
Err(e) => panic!(e),
}

Loading…
Cancel
Save