Crate rb_interval_map
source ·Expand description
interval_map
is a thread-safe map based on interval tree.
It fully implements the insertion and deletion functionality of a red-black tree, ensuring that each modification operation requires at most O(logN) time complexity.
To safely and efficiently handle insertion and deletion operations in Rust,
interval_map
innovatively uses arrays to simulate pointers for managing the parent-child
references in the red-black tree. This approach also ensures that interval_map has the
Send
and Unpin
traits, allowing it to be safely transferred between threads and
to maintain a fixed memory location during asynchronous operations.
§Example
use rb_interval_map::{Interval, IntervalMap};
let mut map = IntervalMap::new();
let int = Interval::new(1, 2);
map.insert(int.clone(), 123456);
assert_eq!(map.get(&int), Some(&123456));
Structs§
- A filter iterator over the entries of a
IntervalMap
.It’s equal toiter().filter()
but faster than the latter. - The interval stored in
IntervalMap
represents [low, high) - An interval-value map, which support operations on dynamic sets of intervals.
- An into iterator over the entries of a
IntervalMap
. - An iterator over the entries of a
IntervalMap
. - A view into an occupied entry in a
IntervalMap
. It is part of theEntry
enum. - An unsorted iterator over the entries of a
IntervalMap
. - A view into a vacant entry in a
IntervalMap
. It is part of theEntry
enum.
Enums§
- A view into a single entry in a map, which may either be vacant or occupied.