10 releases
Uses new Rust 2024
| new 0.2.6 | Feb 13, 2026 |
|---|---|
| 0.2.5 | Jan 29, 2026 |
| 0.2.3 | Dec 21, 2025 |
| 0.2.1 | Nov 5, 2025 |
| 0.0.1 | Sep 28, 2024 |
#694 in Database interfaces
33 downloads per month
Used in 17 crates
(4 directly)
250KB
2.5K
SLoC
saferlmdb
saferlmdb is a near-zero-cost wrapper around LMDB 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_RESERVEto 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.
Dependencies
~1.8–2.4MB
~43K SLoC