pub struct U32Set { /* private fields */ }
Expand description
A fast, efficient, sparse, & ordered u32
set.
For a higher-level API that supports inversion and generic int types, use super::IntSet
Implementations§
Source§impl U32Set
impl U32Set
Sourcepub fn insert(&mut self, val: u32) -> bool
pub fn insert(&mut self, val: u32) -> bool
Add val as a member of this set.
If the set did not previously contain this value, returns true
.
Sourcepub fn insert_range(&mut self, range: RangeInclusive<u32>)
pub fn insert_range(&mut self, range: RangeInclusive<u32>)
Add all values in range as members of this set.
Sourcepub fn extend_unsorted<U: IntoIterator<Item = u32>>(&mut self, iter: U)
pub fn extend_unsorted<U: IntoIterator<Item = u32>>(&mut self, iter: U)
An alternate version of extend()
which is optimized for inserting an unsorted
iterator of values.
Sourcepub fn remove(&mut self, val: u32) -> bool
pub fn remove(&mut self, val: u32) -> bool
Remove val from this set.
Returns true
if the value was present.
pub fn remove_all<U: IntoIterator<Item = u32>>(&mut self, iter: U)
Sourcepub fn remove_range(&mut self, range: RangeInclusive<u32>)
pub fn remove_range(&mut self, range: RangeInclusive<u32>)
Removes all values in range as members of this set.
pub fn intersects_set(&self, other: &U32Set) -> bool
pub const fn empty() -> U32Set
Sourcepub fn union(&mut self, other: &U32Set)
pub fn union(&mut self, other: &U32Set)
Sets the members of this set to the union of self and other.
Sourcepub fn intersect(&mut self, other: &U32Set)
pub fn intersect(&mut self, other: &U32Set)
Sets the members of this set to the intersection of self and other.
Sourcepub fn reversed_subtract(&mut self, other: &U32Set)
pub fn reversed_subtract(&mut self, other: &U32Set)
Sets the members of this set to other - self.
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = u32> + '_
pub fn iter(&self) -> impl DoubleEndedIterator<Item = u32> + '_
Iterator over the members of this set. In sorted order (ascending).
Sourcepub fn iter_from(&self, value: u32) -> impl Iterator<Item = u32> + '_
pub fn iter_from(&self, value: u32) -> impl Iterator<Item = u32> + '_
Iterator over the members of this set starting from value.
So value is included in the iterator if it’s in the set.
Sourcepub fn iter_ranges(&self) -> impl Iterator<Item = RangeInclusive<u32>> + '_
pub fn iter_ranges(&self) -> impl Iterator<Item = RangeInclusive<u32>> + '_
Iterate over the ranges of contiguous values in this set.
Trait Implementations§
Source§impl Extend<u32> for U32Set
impl Extend<u32> for U32Set
Source§fn extend<U: IntoIterator<Item = u32>>(&mut self, iter: U)
fn extend<U: IntoIterator<Item = u32>>(&mut self, iter: U)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)