sled is a high-performance embedded database with an API that is similar to a BTreeMap<[u8], [u8]>
.
typed-sled builds on top of sled and offers an API that is similar to a BTreeMap<K, V>
, where K and V are user defined types.
```rust use serde::{Deserialize, Serialize};
struct SomeValue(u32);
// Creating a temporary sled database let db = sled::Config::new().temporary(true).open().unwrap();
// The id is used by sled to identify which Tree in the database (db) to open
let tree = typedsled::Tree::
// insert and get, similar to std's BTreeMap tree.insert(&"somekey".toowned(), &SomeValue(10))?;
asserteq!(tree.get(&"somekey".to_owned())?, Some(SomeValue(10))); Ok(())
```
Multiple features for common use cases are available: