Expand description
High-performance collections with slab-backed storage.
Collections use thread-local slab allocators for O(1) insert/remove with stable handles and no allocation on the hot path.
§Collections
- List — Doubly-linked list with
RcSlothandles and external allocation - Heap — Pairing heap with
RcSlothandles and external allocation - RbTree — Red-black tree sorted map with deterministic O(log n) worst case
- BTree — B-tree sorted map with cache-friendly, tunable node layout
§Quick Start (RbTree)
ⓘ
mod levels {
nexus_collections::rbtree_allocator!(u64, String, bounded);
}
fn main() {
levels::Allocator::builder().capacity(1000).build().unwrap();
let mut map = levels::RbTree::new(levels::Allocator);
map.try_insert(100, "hello".into()).unwrap();
assert_eq!(map.get(&100), Some(&"hello".into()));
}Re-exports§
pub use compare::Compare;pub use compare::Natural;pub use compare::Reverse;pub use exclusive::ExMut;pub use exclusive::ExRef;pub use exclusive::ExclusiveCell;
Modules§
- btree
- B-tree sorted map with internal slab allocation.
- compare
- Comparison strategy for tree key ordering.
- exclusive
- Single-borrow cell for exclusive access enforcement.
- heap
- Min-heap (pairing heap) with
RcSlot-based stable handles. - list
- Doubly-linked list with
RcSlot-based ownership. - rbtree
- Red-black tree sorted map with internal slab allocation.
Macros§
- bounded_
allocator - Generates a bounded (fixed-capacity) slab allocator for a type.
- bounded_
rc_ allocator - Generates a bounded (fixed-capacity) reference-counted slab allocator.
- btree_
allocator - Creates a B-tree allocator for a specific key-value pair.
- heap_
allocator - Creates a heap allocator for a specific type.
- list_
allocator - Creates a list allocator for a specific type.
- rbtree_
allocator - Creates a red-black tree allocator for a specific key-value pair.
- unbounded_
allocator - Generates an unbounded (growable) slab allocator for a type.
- unbounded_
rc_ allocator - Generates an unbounded (growable) reference-counted slab allocator.
Structs§
- Full
- Error returned when a bounded allocator is full.
Traits§
- Alloc
- Base trait for slab allocators - handles slot deallocation.
- Bounded
Alloc - Trait for bounded (fixed-capacity) allocators.
- Unbounded
Alloc - Trait for unbounded (growable) allocators.