pub struct Coverage { /* private fields */ }Expand description
In-memory coverage over a discrete set of index interval IDs.
Implementations§
Source§impl Coverage
impl Coverage
Sourcepub fn from_treemap(present: RoaringTreemap) -> Self
pub fn from_treemap(present: RoaringTreemap) -> Self
Wrap an existing treemap.
Sourcepub fn present(&self) -> &RoaringTreemap
pub fn present(&self) -> &RoaringTreemap
Borrow the present index interval IDs.
Sourcepub fn into_treemap(self) -> RoaringTreemap
pub fn into_treemap(self) -> RoaringTreemap
Consume the coverage and return its treemap.
Sourcepub fn union_inplace(&mut self, other: &Self)
pub fn union_inplace(&mut self, other: &Self)
Merge another coverage set into this one.
Sourcepub fn intersection_cardinality(&self, other: &Self) -> u64
pub fn intersection_cardinality(&self, other: &Self) -> u64
Count index interval IDs present in both sets without materializing them.
Sourcepub fn cardinality(&self) -> u64
pub fn cardinality(&self) -> u64
Number of present index interval IDs.
Sourcepub fn range_cardinality(range: &RangeInclusive<IndexIntervalId>) -> u128
pub fn range_cardinality(range: &RangeInclusive<IndexIntervalId>) -> u128
Number of index interval IDs in an inclusive range.
Sourcepub fn covered_cardinality(
&self,
range: &RangeInclusive<IndexIntervalId>,
) -> u64
pub fn covered_cardinality( &self, range: &RangeInclusive<IndexIntervalId>, ) -> u64
Count present index interval IDs in a range without materializing it.
Sourcepub fn missing_runs(
&self,
range: &RangeInclusive<IndexIntervalId>,
max_run_len: Option<u64>,
) -> Vec<RangeInclusive<IndexIntervalId>>
pub fn missing_runs( &self, range: &RangeInclusive<IndexIntervalId>, max_run_len: Option<u64>, ) -> Vec<RangeInclusive<IndexIntervalId>>
Return missing contiguous runs in an inclusive requested range.
Long runs are optionally split into chunks of at most max_run_len.
Work is proportional to present index interval IDs and returned runs, not the size
of the requested range.
Sourcepub fn last_run_with_min_len(
&self,
range: &RangeInclusive<IndexIntervalId>,
min_len: u64,
) -> Option<RangeInclusive<IndexIntervalId>>
pub fn last_run_with_min_len( &self, range: &RangeInclusive<IndexIntervalId>, min_len: u64, ) -> Option<RangeInclusive<IndexIntervalId>>
Return the last covered contiguous run of at least min_len IDs.
Sourcepub fn coverage_ratio(&self, range: &RangeInclusive<IndexIntervalId>) -> f64
pub fn coverage_ratio(&self, range: &RangeInclusive<IndexIntervalId>) -> f64
Coverage ratio in [0.0, 1.0] for an inclusive range.
Sourcepub fn max_gap_len(&self, range: &RangeInclusive<IndexIntervalId>) -> u128
pub fn max_gap_len(&self, range: &RangeInclusive<IndexIntervalId>) -> u128
Length of the largest missing run in an inclusive range.
Sourcepub fn last_window_at_or_before(
&self,
end_index_interval_id: IndexIntervalId,
len: u64,
) -> Option<RangeInclusive<IndexIntervalId>>
pub fn last_window_at_or_before( &self, end_index_interval_id: IndexIntervalId, len: u64, ) -> Option<RangeInclusive<IndexIntervalId>>
Return the last fully-covered window ending at or before an index interval ID.
Trait Implementations§
impl Eq for Coverage
Source§impl FromIterator<u64> for Coverage
impl FromIterator<u64> for Coverage
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = IndexIntervalId>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = IndexIntervalId>,
impl StructuralPartialEq for Coverage
Auto Trait Implementations§
impl Freeze for Coverage
impl RefUnwindSafe for Coverage
impl Send for Coverage
impl Sync for Coverage
impl Unpin for Coverage
impl UnsafeUnpin for Coverage
impl UnwindSafe for Coverage
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more