rb_interval_map/
lib.rs

1//! `interval_map` is a thread-safe map based on interval tree.
2//!
3//! It fully implements the insertion and deletion functionality of a red-black tree,
4//! ensuring that each modification operation requires at most O(logN) time complexity.
5//!
6//! To safely and efficiently handle insertion and deletion operations in Rust,
7//! `interval_map` innovatively uses arrays to simulate pointers for managing the parent-child
8//! references in the red-black tree. This approach also ensures that interval_map has the
9//! `Send` and `Unpin` traits, allowing it to be safely transferred between threads and
10//! to maintain a fixed memory location during asynchronous operations.
11//!
12//! # Example
13//!
14//! ```rust
15//! use rb_interval_map::{Interval, IntervalMap};
16//!
17//! let mut map = IntervalMap::new();
18//! let int = Interval::new(1, 2);
19//! map.insert(int.clone(), 123456);
20//! assert_eq!(map.get(&int), Some(&123456));
21//! ```
22//!
23
24mod entry;
25mod index;
26mod interval;
27mod intervalmap;
28mod iter;
29mod node;
30
31#[cfg(test)]
32mod tests;
33
34pub use entry::{Entry, OccupiedEntry, VacantEntry};
35pub use interval::Interval;
36pub use intervalmap::IntervalMap;
37pub use iter::{FilterIter, IntoIter, Iter, UnsortedIter};