Struct id_set::IdSet
[−]
[src]
pub struct IdSet { /* fields omitted */ }A set of usize elements represented by a bit vector. Storage required is proportional to the
maximum element in the set.
Methods
impl IdSet[src]
fn new() -> Self
Creates an empty IdSet.
fn new_filled(n: usize) -> Self
Creates a IdSet filled with all elements from 0 to n.
fn with_capacity(n: usize) -> Self
Creates a empty IdSet that can hold elements up to n before reallocating.
fn len(&self) -> usize
Returns the number of distinct elements in the set.
fn is_empty(&self) -> bool
Returns true if the set is empty.
fn capacity(&self) -> usize
Returns capacity of the set. Inserting any elements less than this will not cause reallocation.
fn reserve(&mut self, cap: usize)
Resizes the set such that capacity() >= cap.
fn shrink_to_fit(&mut self)
Resizes the set such that capacity() is minimal.
fn clear(&mut self)
Removes all elements from the set.
fn insert(&mut self, id: Id) -> bool
Inserts the given elements into the set, returning true if it was not already in the set.
fn remove(&mut self, id: Id) -> bool
Removes the given element from the set, returning true if it was in the set.
fn contains(&self, id: Id) -> bool
Returns true if the given element is in the set.
fn retain<F: FnMut(Id) -> bool>(&mut self, pred: F)
Remove all elements that don't satisfy the predicate.
fn as_blocks(&self) -> &[Block]
Returns a slice of the underlying blocks.
fn iter(&self) -> Iter
An iterator over all elements in increasing order.
fn blocks(&self) -> Blocks
An iterator over the blocks of the underlying representation.
fn into_blocks(self) -> IntoBlocks
A consuming iterator over the blocks of the underlying representation.
fn union<'a>(&'a self, other: &'a Self) -> IdIter<Union<Blocks<'a>, Blocks<'a>>>
Iterator over the union of two sets.
Equivalent to self.blocks().union(other.blocks()).into_id_iter().
fn intersection<'a>(
&'a self,
other: &'a Self
) -> IdIter<Intersection<Blocks<'a>, Blocks<'a>>>
&'a self,
other: &'a Self
) -> IdIter<Intersection<Blocks<'a>, Blocks<'a>>>
Iterator over the intersection of two sets.
Equivalent to self.blocks().intersection(other.blocks()).into_id_iter().
fn difference<'a>(
&'a self,
other: &'a Self
) -> IdIter<Difference<Blocks<'a>, Blocks<'a>>>
&'a self,
other: &'a Self
) -> IdIter<Difference<Blocks<'a>, Blocks<'a>>>
Iterator over the difference of two sets.
Equivalent to self.blocks().difference(other.blocks()).into_id_iter().
fn symmetric_difference<'a>(
&'a self,
other: &'a Self
) -> IdIter<SymmetricDifference<Blocks<'a>, Blocks<'a>>>
&'a self,
other: &'a Self
) -> IdIter<SymmetricDifference<Blocks<'a>, Blocks<'a>>>
Iterator over the symmetric difference of two sets.
Equivalent to self.blocks().symmetric_difference(other.blocks()).into_id_iter().
fn complement(&self) -> IdIter<Complement<Blocks>>
Iterator over the complement of the set. This iterator will never return None.
fn union_with(&mut self, other: &Self)
Take the union of the set with another set.
fn intersect_with(&mut self, other: &Self)
Take the intersection of the set with another set.
fn difference_with(&mut self, other: &Self)
Take the difference of the set with another set.
fn symmetric_difference_with(&mut self, other: &Self)
Take the symmetric difference of the set with another set.
fn is_disjoint(&self, other: &Self) -> bool
Returns true if the sets are disjoint.
fn is_superset(&self, other: &Self) -> bool
Returns true if self is a superset of other.
fn is_subset(&self, other: &Self) -> bool
Returns true if self is a subset of other.
Trait Implementations
impl Clone for IdSet[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
impl Debug for IdSet[src]
impl Default for IdSet[src]
impl Eq for IdSet[src]
impl PartialEq for IdSet[src]
fn eq(&self, other: &Self) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0
This method tests for !=.
impl Extend<Id> for IdSet[src]
fn extend<I: IntoIterator<Item = Id>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
impl FromIterator<Id> for IdSet[src]
fn from_iter<I: IntoIterator<Item = Id>>(iter: I) -> Self
Creates a value from an iterator. Read more
impl<'a> IntoIterator for &'a IdSet[src]
type Item = Id
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more