[−][src]Struct coitrees::COITree
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]
T: Clone,
I: IntWithMax,
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]
F: FnMut(&'a IntervalNode<T, I>),
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]
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>;
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]
T: Clone,
I: IntWithMax,
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?
fn into_iter(self) -> COITreeIterator<'a, 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]
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>;
Auto Trait Implementations
impl<T, I> RefUnwindSafe for COITree<T, I> where
I: RefUnwindSafe,
T: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, I> Send for COITree<T, I> where
I: Send,
T: Send,
I: Send,
T: Send,
impl<T, I> Sync for COITree<T, I> where
I: Sync,
T: Sync,
I: Sync,
T: Sync,
impl<T, I> Unpin for COITree<T, I> where
I: Unpin,
T: Unpin,
I: Unpin,
T: Unpin,
impl<T, I> UnwindSafe for COITree<T, I> where
I: UnwindSafe,
T: UnwindSafe,
I: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,