pub struct RangeSet<T> { /* private fields */ }
Expand description
A set of integers, implemented as a sorted list of (inclusive) ranges.
Implementations§
Source§impl<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> ⓘ
pub fn ranges<'a>(&'a self) -> RangeIter<'a, T> ⓘ
Returns an iterator over all ranges in this set.
Sourcepub fn elements<'a>(&'a self) -> EltIter<'a, T> ⓘ
pub fn elements<'a>(&'a self) -> EltIter<'a, 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§
Source§impl<T: Debug + PrimInt> FromIterator<Range<T>> for RangeSet<T>
impl<T: Debug + PrimInt> FromIterator<Range<T>> for RangeSet<T>
Source§fn 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.
impl<T: Eq> Eq for RangeSet<T>
impl<T> StructuralPartialEq for RangeSet<T>
Auto Trait Implementations§
impl<T> Freeze for RangeSet<T>
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§
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
Mutably borrows from an owned value. Read more