[][src]Struct intervaltree::IntervalTree

pub struct IntervalTree<K, V> { /* fields omitted */ }

A simple and generic implementation of an immutable interval tree.

To build it, always use FromIterator. This is not very optimized as it takes O(log n) stack (it uses recursion) but runs in O(n log n).

Implementations

impl<K: Ord, V> IntervalTree<K, V>[src]

pub fn query(&self, range: Range<K>) -> QueryIter<K, V>[src]

Queries the interval tree for all elements overlapping a given interval.

This runs in O(log n + m).

pub fn query_point(&self, point: K) -> QueryIter<K, V>[src]

Queries the interval tree for all elements containing a given point.

This runs in O(log n + m).

pub fn iter(&self) -> TreeIter<K, V>[src]

Returns an iterator over all elements in the tree (in no particular order).

pub fn iter_sorted<'a>(&'a self) -> impl Iterator<Item = &'a Element<K, V>>[src]

Returns an iterator over all elements in the tree, sorted by Element.range.start.

This is currently identical to IntervalTree::iter because the internal structure is already sorted this way, but may not be in the future.

Trait Implementations

impl<K: Clone, V: Clone> Clone for IntervalTree<K, V>[src]

impl<K: Debug, V: Debug> Debug for IntervalTree<K, V>[src]

impl<K: Ord + Clone, V, I: Into<Element<K, V>>> FromIterator<I> for IntervalTree<K, V>[src]

impl<K: Hash, V: Hash> Hash for IntervalTree<K, V>[src]

impl<'a, K: 'a + Ord, V: 'a> IntoIterator for &'a IntervalTree<K, V>[src]

type Item = &'a Element<K, V>

The type of the elements being iterated over.

type IntoIter = TreeIter<'a, K, V>

Which kind of iterator are we turning this into?

impl<K, V> IntoIterator for IntervalTree<K, V>[src]

type Item = Element<K, V>

The type of the elements being iterated over.

type IntoIter = TreeIntoIter<K, V>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<K, V> RefUnwindSafe for IntervalTree<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for IntervalTree<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for IntervalTree<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for IntervalTree<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for IntervalTree<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.