mappedbptree
A persistent, memory-mapped B+tree for Rust with a BTreeMap-like API.
Built by Claude.
Features
- File-backed storage via
mmap— data survives process restarts - Thread-safe: multiple concurrent readers, exclusive writers (
RwLock) - Zero-copy access to keys and values via
bytemuck::Pod - Full B+tree operations:
insert,get,remove,iter,range,clear - Auto-tuned node capacity based on system page size (4096 bytes)
Constraints
Keys (K: Ord + Pod) and values (V: Pod) must be plain-data types — fixed-size,
no heap allocations. Integers, arrays, and #[repr(C)] structs work; String and
Vec do not.
Quick start
[]
= "0.1"
use MmapBTreeBuilder;
let tree = new
.path
.build?;
tree.insert?;
assert_eq!;
tree.remove?;
for in tree.range?
License
MIT