pub struct NonOverlappingIntervalTree<K, V> { /* private fields */ }
Expand description
An implementation of a non-overlapping interval tree.
Keys are ranges, Range
Implementations
Insert a value into the tree for a given range, not checking to see if any overlapping
occurs. If there’s an element whose range starts with int
’s start, that element is removed
and returned.
Safety
This function can potentially corrupt the tree, since the normal operation functions rely on there being no overlaps. Care must be taken when using this function to ensure the no-overlap property manually.
Insert a value into the tree for a given range, removing and returning all K,V pairs that are in the tree that overlap with the inserted range.
Examples
use nonoverlapping_interval_tree::NonOverlappingIntervalTree;
let mut it = NonOverlappingIntervalTree::new();
it.insert_replace(1..3, "hello");
Get an immutable reference to the value of a single point in the interval tree, returning the value for a range that contains this point if one exists.
Get a mutable reference to the value of a single point in the interval tree, returning the value for a range that contains this point if one exists.
Remove the value associated with the range that contains the point argument. If one is present, it is removed and returned, otherwise None is returned.
Returns a double-ended iterator over a sub-range of elements in the map. The resulting range may contain individual points that are not in the provided range if the stored ranges overlap with the terminating point. For example, if the tree contains [[1..3], [4..6]], and you call tree.range(1..5), you’ll get back [[1..3], [4..6]], since the 4..6 range contains 4 as requested by the call to range.
Returns a mutable double-ended iterator over a sub-range of elements in the map. The resulting range may contain individual points that are not in the provided range if the stored ranges overlap with the terminating point. For example, if the tree contains [[1..3], [4..6]], and you call tree.range(1..5), you’ll get back [[1..3], [4..6]], since the 4..6 range contains 4 as requested by the call to range.
Return an iterator for the tree, sorted by key.
Return an iterator for the tree, sorted by key.
Trait Implementations
Auto Trait Implementations
impl<K, V> RefUnwindSafe for NonOverlappingIntervalTree<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for NonOverlappingIntervalTree<K, V> where
K: Send,
V: Send,
impl<K, V> Sync for NonOverlappingIntervalTree<K, V> where
K: Sync,
V: Sync,
impl<K, V> Unpin for NonOverlappingIntervalTree<K, V>
impl<K, V> UnwindSafe for NonOverlappingIntervalTree<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more