A modern embedded database. Written in Rust, usable on servers and phones from any C-compatible language.
let db = sled::open(path)?; // as in fs::open
db.insert(k, v)?; // as in BTreeMap::insert
db.get(&k)?; // as in BTreeMap::get
for kv in db.range(k..) {} // as in BTreeMap::range
db.remove(&k)?; // as in BTreeMap::remove
drop(db); // fsync and close file
Embedded databases are useful in several cases:
BTreeMap<[u8], [u8]>
compression
build feature)