A thin wrapped on top of [LMDB] with minimum overhead. It is derived from the heed crate which is more typed and a little bit more complex.
It provides you a way to store key/values in LMDB without any limit and with a minimal overhead.
```rust fs::createdirall("target/heed.mdb")?; let env = EnvOpenOptions::new().open("target/heed.mdb")?;
// We open the default unamed database. // Specifying the type of the newly created database. // Here we specify that the key is an str and the value a simple integer. let db = env.create_database(None)?;
// We then open a write transaction and start writing into the database. // All of those puts are type checked at compile time, // therefore you cannot write an integer instead of a string. let mut wtxn = env.writetxn()?; db.put(&mut wtxn, "seven", 7i32.tobebytes())?; db.put(&mut wtxn, "zero", 0i32.tobebytes())?; db.put(&mut wtxn, "five", 5i32.tobebytes())?; db.put(&mut wtxn, "three", 3i32.tobe_bytes())?; wtxn.commit()?;
// We open a read transaction to check if those values are available. // When we read we also type check at compile time. let rtxn = env.read_txn()?;
let ret = db.get(&rtxn, "zero")?; asserteq!(ret, Some(&0i32.tobebytes()[..]));
let ret = db.get(&rtxn, "five")?; asserteq!(ret, Some(&5.tobe_bytes()[..])); ```
You want to see more about all the possibilities? Go check out the examples.