flat_rbtree
A fast, index-based Red-Black Tree with no heap allocations — ideal for systems where performance and memory layout matter.
Features
- Flat storage: all nodes are stored in a
Vec, avoiding pointer indirection. - No allocations per node: avoids
Box,Rc, orArc. - Predictable layout: great for cache locality.
- No-std friendly (optional): suitable for embedded environments.
- Safe Rust: zero
unsafeblocks.
Design Rationale
- Nodes are indexed (usize) instead of heap-allocated.
- Sentinel node used for null-equivalent leaf representation.
- Explicit free-list for reusing memory.
- Inspired by flat ECS-like data layouts and arena-based allocators.
Usage
let mut tree = new;
tree.insert;
tree.search; // Some(&"A")
tree.remove;
Optional no_std Support
[]
= "0.1"
= false
= ["alloc"]
📝 License
This project is open-source under the MIT License.