Expand description
rocksbin-db is a simple library wrapping rocksdb in
an interface mimicing rust collections like HashMap.
It does this by utilising serde and bincode to automaticly serialize data you enter into the database.
§Examples
#[macro_use]
extern crate serde_derive;
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
struct Fish {
count: u64,
latin_name: String,
}
let db = rocksbin::DB::open("db_dir").unwrap();
let fish = db.prefix::<String, Fish>(b"fish").unwrap();
let salmon = Fish {
count: 100,
latin_name: "Salmo salar".to_string(),
};
fish.insert("salmon", &salmon);
assert_eq!(fish.get("salmon").unwrap(), Some(salmon));
Structs§
- DB
- A wrapper over a rocksdb database.
- Iter
- An iterator over the key-value pairs of a prefix.
- Keys
- An iterator over the keys of a prefix.
- Prefix
- A grouping of data in a database.
- Prefix
Group - A way to group prefixes.
- Values
- An iterator over the values of a prefix.
Enums§
- Error
Kind - Errors that can occur.