pub struct IndexSet<'a, T: IndexedValue + 'a, S, P: PointerFamily<'a>> { /* private fields */ }
Expand description
An unordered collections of T
s, implemented with a bit-set.
Implementations§
Source§impl<'a, T, S, P> IndexSet<'a, T, S, P>
impl<'a, T, S, P> IndexSet<'a, 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.
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<'a, T, S, P>) -> bool
pub fn is_superset(&self, other: &IndexSet<'a, 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 remove<M>(&mut self, elt: impl ToIndex<T, M>) -> bool
pub fn remove<M>(&mut self, elt: impl ToIndex<T, M>) -> bool
Removes the element elt
from self
, returning true if self
changed.
Sourcepub fn union_changed(&mut self, other: &IndexSet<'a, T, S, P>) -> bool
pub fn union_changed(&mut self, other: &IndexSet<'a, T, S, P>) -> bool
Adds each element of other
to self
, returning true if self
changed.
Sourcepub fn subtract(&mut self, other: &IndexSet<'a, T, S, P>)
pub fn subtract(&mut self, other: &IndexSet<'a, T, S, P>)
Removes every element of other
from self
.
Sourcepub fn subtract_changed(&mut self, other: &IndexSet<'a, T, S, P>) -> bool
pub fn subtract_changed(&mut self, other: &IndexSet<'a, T, S, P>) -> bool
Removes every element of other
from self
, returning true if self
changed.
Sourcepub fn intersect(&mut self, other: &IndexSet<'a, T, S, P>)
pub fn intersect(&mut self, other: &IndexSet<'a, T, S, P>)
Removes every element of self
not in other
.
Sourcepub fn intersect_changed(&mut self, other: &IndexSet<'a, T, S, P>) -> bool
pub fn intersect_changed(&mut self, other: &IndexSet<'a, 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
.