Skip to content

Commit

Permalink
update WriteBatch example (#686)
Browse files Browse the repository at this point in the history
Signed-off-by: Nugine <nugine@foxmail.com>
  • Loading branch information
Nugine authored Apr 23, 2022
1 parent e97c9b5 commit c616c67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ fn main() {
// NB: db is automatically freed at end of lifetime
let mut db = DB::open_default("/path/for/rocksdb/storage").unwrap();
{
let mut batch = WriteBatch::new(); // WriteBatch and db both have trait Writable
let batch = WriteBatch::new(); // WriteBatch and db both have trait Writable
batch.put(b"my key", b"my value");
batch.put(b"key2", b"value2");
batch.put(b"key3", b"value3");
db.write(batch); // Atomically commits the batch
db.write(&batch).unwrap(); // Atomically commits the batch
}
}
```
Expand Down

0 comments on commit c616c67

Please sign in to comment.