intrex
Intrusive collections with items stored in an application-provided object pool and addressed by indices.
Features
-
#![no_std]+ no-alloc -
Intrusive doubly-linked lists
-
Intrusive binary trees with optional search capability
- Unbalanced
- Red-black with reshaping hooks (useful for implementing order-statistic trees, etc.; see
tests/rbtree_order_stats.rsfor an example)
-
A generic subroutine to sort singly-linked lists
Example: Doubly-Linked List
use ;
let mut nodes: =
.map
.collect;
let mut head = default;
// Add [2, 3, 1, 0] to the list
let mut accessor = head.write_ref;
accessor.push_back;
accessor.push_back;
accessor.insert;
accessor.push_front;
// Inspect the list
let accessor = head.read_ref;
assert_eq!;
assert_eq!;
assert_eq!;
// Sort the list
head.write_ref
.sort_by_key;
let accessor = head.read_ref;
assert_eq!;
License
MIT/Apache-2.0