# saferlmdb
[](https://crates.io/crates/saferlmdb)
[](https://docs.rs/saferlmdb/)
[](https://deps.rs/crate/saferlmdb/0.2.6)
saferlmdb is a near-zero-cost wrapper around [LMDB](http://lmdb.tech/) designed
to allow using the full range of features offered by LMDB while keeping it
reasonably easy to write safe programs.
`saferlmdb` is as much as possible a 1:1 mapping of the raw API, mainly
providing RAII constructs and integration into Rust's borrow checker to ensure
safety.
## Fork Notice
Originally forked from https://github.com/AltSysrq/lmdb-zero. All the interesting
parts were implemented by the original maintainer; this fork just brings the crate
up to date so it can be used in crates that use newer versions/editions of Rust.
`lmdb-zero` was find-and-replaced with `saferlmdb`.
Was also updated to lint with `clippy::pedantic`.
## Naming
the "safer" in `saferlmdb` is an unserious poke at Rust, not a
comment on the underlying C library, or a claim about any additional
"safety" this abstraction offers, on top of base LMDB.
## Features
- Zero-copy API. Reads return references into the memory-mapped file. Using
`MDB_RESERVE` to allocate space in the file and directly write to it is
supported.
- Cursors directly map to the same operations provided by LMDB, but in a
typesafe manner.
- Nested transactions.
- Full integration with the borrow checker. Read references are checked to not
outlive their transaction or overlap with a write in the same transaction.
- Cursors and read transactions can be reset and reused.