pub struct IntervalTree<T, V> { /* private fields */ }Expand description
An immutable interval tree optimized for overlap queries.
The tree is constructed via IntervalTreeBuilder and is immutable after
construction, making it Send + Sync by default.
§Data Layout
Data is laid out contiguously per node for SIMD-friendly scanning:
- Each node’s intervals are stored contiguously in
starts,ends,values - Within a node, intervals are sorted by start (ascending)
by_end_indicesprovides descending-by-end ordering via indirection
Implementations§
Source§impl<T, V> IntervalTree<T, V>
impl<T, V> IntervalTree<T, V>
Sourcepub fn builder() -> IntervalTreeBuilder<T, V>
pub fn builder() -> IntervalTreeBuilder<T, V>
Creates a new builder for constructing an interval tree.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in the tree.
Source§impl<T: Ord + Copy, V> IntervalTree<T, V>
impl<T: Ord + Copy, V> IntervalTree<T, V>
Sourcepub fn query<R: Into<Interval<T>>>(&self, range: R) -> QueryIter<'_, T, V> ⓘ
pub fn query<R: Into<Interval<T>>>(&self, range: R) -> QueryIter<'_, T, V> ⓘ
Queries for all intervals overlapping the given range.
Returns an iterator that yields entries without allocation.
Sourcepub fn query_with<R, F, B>(&self, range: R, callback: F) -> ControlFlow<B>
pub fn query_with<R, F, B>(&self, range: R, callback: F) -> ControlFlow<B>
Queries with a callback for early termination.
The callback receives each overlapping interval and can return
ControlFlow::Break(result) to stop iteration early.
Source§impl<V> IntervalTree<i64, V>
impl<V> IntervalTree<i64, V>
Sourcepub fn query_simd<R, F, B>(&self, range: R, callback: F) -> ControlFlow<B>
pub fn query_simd<R, F, B>(&self, range: R, callback: F) -> ControlFlow<B>
Queries with SIMD acceleration for i64 intervals.
Trait Implementations§
Source§impl<T: Clone, V: Clone> Clone for IntervalTree<T, V>
impl<T: Clone, V: Clone> Clone for IntervalTree<T, V>
Source§fn clone(&self) -> IntervalTree<T, V>
fn clone(&self) -> IntervalTree<T, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<T: Send, V: Send> Send for IntervalTree<T, V>
impl<T: Sync, V: Sync> Sync for IntervalTree<T, V>
Auto Trait Implementations§
impl<T, V> Freeze for IntervalTree<T, V>
impl<T, V> RefUnwindSafe for IntervalTree<T, V>where
T: RefUnwindSafe,
V: RefUnwindSafe,
impl<T, V> Unpin for IntervalTree<T, V>
impl<T, V> UnwindSafe for IntervalTree<T, V>where
T: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more