pub struct RangeSet<T> { /* private fields */ }
Available on crate feature
std
only.Expand description
A set of disjoint ranges over numeric types.
Overlapping and adjacent ranges are automatically merged together.
Implementations§
Source§impl<T> RangeSet<T>
impl<T> RangeSet<T>
pub fn is_empty(&self) -> bool
Sourcepub fn insert(&mut self, range: RangeInclusive<T>)
pub fn insert(&mut self, range: RangeInclusive<T>)
Insert a range into this set, automatically merging with existing ranges as needed.
Sourcepub fn iter(&self) -> impl Iterator<Item = RangeInclusive<T>> + '_
pub fn iter(&self) -> impl Iterator<Item = RangeInclusive<T>> + '_
Returns an iterator over the contained ranges.
Sourcepub fn intersection<'a>(
&'a self,
other: &'a Self,
) -> impl Iterator<Item = RangeInclusive<T>> + 'a
pub fn intersection<'a>( &'a self, other: &'a Self, ) -> impl Iterator<Item = RangeInclusive<T>> + 'a
Returns an iterator over the intersection of this and other.
Trait Implementations§
Source§impl<T> Extend<RangeInclusive<T>> for RangeSet<T>
impl<T> Extend<RangeInclusive<T>> for RangeSet<T>
Source§fn extend<I: IntoIterator<Item = RangeInclusive<T>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = RangeInclusive<T>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<T> FromIterator<RangeInclusive<T>> for RangeSet<T>
impl<T> FromIterator<RangeInclusive<T>> for RangeSet<T>
Source§fn from_iter<I: IntoIterator<Item = RangeInclusive<T>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = RangeInclusive<T>>>(iter: I) -> Self
Creates a value from an iterator. Read more
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>
impl<T> UnwindSafe for RangeSet<T>where
T: RefUnwindSafe,
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