1
0
Fork
You've already forked intrex-rs
0
Intrusive doubly linked list with items addressed by indices.
  • Rust 100%
yvt 7ee19f1a8a
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
test(list_rc): add list_rc integration test
> An example program using `intrex::list` to provide an API similar to
> the `intrusive-collections` crate.
2026年05月10日 13:30:54 +09:00
src Merge branch 'feat-rbtree-reshape-hooks' 2026年05月10日 00:43:13 +09:00
tests test(list_rc): add list_rc integration test 2026年05月10日 13:30:54 +09:00
.gitignore chore(gitignore): ignore /local 2026年03月14日 21:20:09 +09:00
.woodpecker.yml chore(ci): set up Woodpecker CI 2026年03月13日 23:11:00 +09:00
Cargo.lock test(rbtree_order_stats): add rbtree_order_stats integration test 2026年05月09日 23:19:48 +09:00
Cargo.toml chore: update package.description to match actual features 2026年05月10日 00:55:51 +09:00
LICENSE-APACHE chore: relicense under MIT OR Apache-2.0 2026年03月10日 12:40:52 +09:00
LICENSE-MIT chore: relicense under MIT OR Apache-2.0 2026年03月10日 12:40:52 +09:00
README.md doc(readme): add no-std and no-alloc to "Features" 2026年05月10日 00:52:54 +09:00
rust-toolchain.toml chore: set MSRV to 1.90 2026年03月10日 19:52:42 +09:00

intrex

docs.rs

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.rs for an example)
  • A generic subroutine to sort singly-linked lists

Example: Doubly-Linked List

useintrex::list::{Head,Link};struct Node{value: i32,siblings: Option<Link>,}letmutnodes: Vec<_>=(0..4).map(|value|Node{value,siblings: None }).collect();letmuthead=Head::default();// Add [2, 3, 1, 0] to the list
letmutaccessor=head.write_ref(&mutnodes,|n: &mutNode|&mutn.siblings);accessor.push_back(3);accessor.push_back(0);accessor.insert(1,Some(0));accessor.push_front(2);// Inspect the list
letaccessor=head.read_ref(&nodes,|n|&n.siblings);assert_eq!(accessor.front().unwrap().value,2);assert_eq!(accessor.back().unwrap().value,0);assert_eq!(accessor.values().map(|n|n.value).collect::<Vec<_>>(),vec![2,3,1,0],);// Sort the list
head.write_ref(&mutnodes,|n: &mutNode|&mutn.siblings).sort_by_key(|nodes,i|nodes.pool[i].value);letaccessor=head.read_ref(&nodes,|n|&n.siblings);assert_eq!(accessor.values().map(|n|n.value).collect::<Vec<_>>(),vec![0,1,2,3],);

License

MIT/Apache-2.0