[][src]Struct coitrees::COITree

pub struct COITree<T, I> where
    T: Clone,
    I: IntWithMax
{ /* fields omitted */ }

COITree data structure. A representation of a static set of intervals with associated metadata, enabling fast overlap and coverage queries.

The index type I is a typically usize, but can be u32 or u16. It's slightly more efficient to use a smalled index type, assuming there are fewer than I::MAX-1 intervals to store.

Implementations

impl<T, I> COITree<T, I> where
    T: Clone,
    I: IntWithMax
[src]

pub fn new(nodes: Vec<IntervalNode<T, I>>) -> COITree<T, I>[src]

pub fn len(&self) -> usize[src]

Number of intervals in the set.

pub fn is_empty(&self) -> bool[src]

True iff the set is empty.

pub fn query<'a, F>(&'a self, first: i32, last: i32, visit: F) where
    F: FnMut(&'a IntervalNode<T, I>), 
[src]

Find intervals in the set overlaping the query [first, last] and call visit on every overlapping node

pub fn query_count(&self, first: i32, last: i32) -> usize[src]

Count the number of intervals in the set overlapping the query [first, last].

pub fn coverage(&self, first: i32, last: i32) -> (usize, usize)[src]

Return a pair (count, cov), where count gives the number of intervals in the set overlapping the query, and cov the number of positions in the query interval covered by at least one interval in the set.

pub fn iter(&self) -> COITreeIterator<T, I>

Important traits for COITreeIterator<'a, T, I>

impl<'a, T, I> Iterator for COITreeIterator<'a, T, I> where
    T: Clone,
    I: IntWithMax
type Item = &'a IntervalNode<T, I>;
[src]

Iterate through the interval set in sorted order by interval start position.

Trait Implementations

impl<'a, T, I> IntoIterator for &'a COITree<T, I> where
    T: Clone,
    I: IntWithMax
[src]

type Item = &'a IntervalNode<T, I>

The type of the elements being iterated over.

type IntoIter = COITreeIterator<'a, T, I>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<T, I> RefUnwindSafe for COITree<T, I> where
    I: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, I> Send for COITree<T, I> where
    I: Send,
    T: Send

impl<T, I> Sync for COITree<T, I> where
    I: Sync,
    T: Sync

impl<T, I> Unpin for COITree<T, I> where
    I: Unpin,
    T: Unpin

impl<T, I> UnwindSafe for COITree<T, I> where
    I: UnwindSafe,
    T: 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<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.