pub struct IndexSet<T: IndexedValue, S: BitSet, P: PointerFamily> { /* private fields */ }
Expand description
An unordered collections of T
s, implemented with a bit-set.
Implementations§
source§impl<T, S, P> IndexSet<T, S, P>
impl<T, S, P> IndexSet<T, S, P>
sourcepub fn new(domain: &P::Pointer<IndexedDomain<T>>) -> Self
pub fn new(domain: &P::Pointer<IndexedDomain<T>>) -> Self
Creates an empty index set.
source§impl<T, S, P> IndexSet<T, S, P>
impl<T, S, P> IndexSet<T, S, P>
sourcepub fn indices(&self) -> impl Iterator<Item = T::Index> + '_
pub fn indices(&self) -> impl Iterator<Item = T::Index> + '_
Returns an iterator over all the indices contained in self
.
sourcepub fn iter(&self) -> impl Iterator<Item = &T> + '_
pub fn iter(&self) -> impl Iterator<Item = &T> + '_
Returns an iterator over all the objects contained in self
.
sourcepub fn iter_enumerated(&self) -> impl Iterator<Item = (T::Index, &T)> + '_
pub fn iter_enumerated(&self) -> impl Iterator<Item = (T::Index, &T)> + '_
Returns an iterator over the pairs of indices and objects contained in self
.
sourcepub fn contains<M>(&self, index: impl ToIndex<T, M>) -> bool
pub fn contains<M>(&self, index: impl ToIndex<T, M>) -> bool
Returns true if index
is contained in self
.
sourcepub fn is_superset(&self, other: &IndexSet<T, S, P>) -> bool
pub fn is_superset(&self, other: &IndexSet<T, S, P>) -> bool
Returns true if every element in other
is also in self
.
sourcepub fn insert<M>(&mut self, elt: impl ToIndex<T, M>) -> bool
pub fn insert<M>(&mut self, elt: impl ToIndex<T, M>) -> bool
Adds the element elt
to self
, returning true if self
changed.
sourcepub fn union_changed(&mut self, other: &IndexSet<T, S, P>) -> bool
pub fn union_changed(&mut self, other: &IndexSet<T, S, P>) -> bool
Adds each element of other
to self
, returning true if self
changed.
sourcepub fn subtract(&mut self, other: &IndexSet<T, S, P>)
pub fn subtract(&mut self, other: &IndexSet<T, S, P>)
Removes every element of other
from self
.
sourcepub fn subtract_changed(&mut self, other: &IndexSet<T, S, P>) -> bool
pub fn subtract_changed(&mut self, other: &IndexSet<T, S, P>) -> bool
Removes every element of other
from self
, returning true if self
changed.
sourcepub fn intersect(&mut self, other: &IndexSet<T, S, P>)
pub fn intersect(&mut self, other: &IndexSet<T, S, P>)
Removes every element of self
not in other
.
sourcepub fn intersect_changed(&mut self, other: &IndexSet<T, S, P>) -> bool
pub fn intersect_changed(&mut self, other: &IndexSet<T, S, P>) -> bool
Removes every element of self
not in other
, returning true if self
changed.
sourcepub fn insert_all(&mut self)
pub fn insert_all(&mut self)
Adds every element of the domain to self
.