pub struct RangeSet<T> { /* private fields */ }
Expand description
A set of integers, implemented as a sorted list of (inclusive) ranges.
Implementations
sourceimpl<T: Debug + PrimInt> RangeSet<T>
impl<T: Debug + PrimInt> RangeSet<T>
sourcepub fn num_ranges(&self) -> usize
pub fn num_ranges(&self) -> usize
Returns the number of ranges used to represent this set.
sourcepub fn num_elements(&self) -> usize
pub fn num_elements(&self) -> usize
Returns the number of elements in the set.
This saturates at usize::MAX
.
sourcepub fn ranges<'a>(&'a self) -> RangeIter<'a, T>ⓘNotable traits for RangeIter<'a, T>impl<'a, T: Debug + PrimInt> Iterator for RangeIter<'a, T> type Item = Range<T>;
pub fn ranges<'a>(&'a self) -> RangeIter<'a, T>ⓘNotable traits for RangeIter<'a, T>impl<'a, T: Debug + PrimInt> Iterator for RangeIter<'a, T> type Item = Range<T>;
Returns an iterator over all ranges in this set.
sourcepub fn elements<'a>(&'a self) -> EltIter<'a, T>ⓘNotable traits for EltIter<'a, T>impl<'a, T: Debug + PrimInt> Iterator for EltIter<'a, T> type Item = T;
pub fn elements<'a>(&'a self) -> EltIter<'a, T>ⓘNotable traits for EltIter<'a, T>impl<'a, T: Debug + PrimInt> Iterator for EltIter<'a, T> type Item = T;
Returns an iterator over all elements in this set.
sourcepub fn union(&self, other: &RangeSet<T>) -> RangeSet<T>
pub fn union(&self, other: &RangeSet<T>) -> RangeSet<T>
Returns the union between self
and other
.
sourcepub fn except<I: Iterator<Item = T>>(it: I) -> Option<RangeSet<T>>
pub fn except<I: Iterator<Item = T>>(it: I) -> Option<RangeSet<T>>
Creates a set containing all elements except the given ones. The input iterator must be
sorted. If it is not, this will return None
.
sourcepub fn intersection(&self, other: &RangeSet<T>) -> RangeSet<T>
pub fn intersection(&self, other: &RangeSet<T>) -> RangeSet<T>
Finds the intersection between this set and other
.
Trait Implementations
sourceimpl<T: Debug + PrimInt> FromIterator<Range<T>> for RangeSet<T>
impl<T: Debug + PrimInt> FromIterator<Range<T>> for RangeSet<T>
sourcefn from_iter<I: IntoIterator<Item = Range<T>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Range<T>>>(iter: I) -> Self
Builds a RangeSet
from an iterator over Range
s.
sourceimpl<T: PartialEq> PartialEq<RangeSet<T>> for RangeSet<T>
impl<T: PartialEq> PartialEq<RangeSet<T>> for RangeSet<T>
impl<T: Eq> Eq for RangeSet<T>
impl<T> StructuralEq for RangeSet<T>
impl<T> StructuralPartialEq for RangeSet<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for RangeSet<T>where
T: RefUnwindSafe,
impl<T> Send for RangeSet<T>where
T: Send,
impl<T> Sync for RangeSet<T>where
T: Sync,
impl<T> Unpin for RangeSet<T>where
T: Unpin,
impl<T> UnwindSafe for RangeSet<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more