Struct indexical::IndexSet

source ·
pub struct IndexSet<T: IndexedValue, S: BitSet, P: PointerFamily> { /* private fields */ }
Expand description

An unordered collections of Ts, implemented with a bit-set.

Implementations§

source§

impl<T, S, P> IndexSet<T, S, P>

source

pub fn new(domain: &P::Pointer<IndexedDomain<T>>) -> Self

Creates an empty index set.

source§

impl<T, S, P> IndexSet<T, S, P>

source

pub fn indices(&self) -> impl Iterator<Item = T::Index> + '_

Returns an iterator over all the indices contained in self.

source

pub fn iter(&self) -> impl Iterator<Item = &T> + '_

Returns an iterator over all the objects contained in self.

source

pub fn iter_enumerated(&self) -> impl Iterator<Item = (T::Index, &T)> + '_

Returns an iterator over the pairs of indices and objects contained in self.

source

pub fn contains<M>(&self, index: impl ToIndex<T, M>) -> bool

Returns true if index is contained in self.

source

pub fn len(&self) -> usize

Returns the number of elements in self.

source

pub fn is_empty(&self) -> bool

Return true if self has no elements.

source

pub fn is_superset(&self, other: &IndexSet<T, S, P>) -> bool

Returns true if every element in other is also in self.

source

pub fn insert<M>(&mut self, elt: impl ToIndex<T, M>) -> bool

Adds the element elt to self, returning true if self changed.

source

pub fn union(&mut self, other: &IndexSet<T, S, P>)

Adds each element of other to self.

source

pub fn union_changed(&mut self, other: &IndexSet<T, S, P>) -> bool

Adds each element of other to self, returning true if self changed.

source

pub fn subtract(&mut self, other: &IndexSet<T, S, P>)

Removes every element of other from self.

source

pub fn subtract_changed(&mut self, other: &IndexSet<T, S, P>) -> bool

Removes every element of other from self, returning true if self changed.

source

pub fn intersect(&mut self, other: &IndexSet<T, S, P>)

Removes every element of self not in other.

source

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.

source

pub fn insert_all(&mut self)

Adds every element of the domain to self.

source

pub fn clear(&mut self)

Removes every element from self.

source

pub fn inner(&self) -> &S

Returns a reference to the inner set.

Trait Implementations§

source§

impl<T, S, P> Clone for IndexSet<T, S, P>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T, S, P> Debug for IndexSet<T, S, P>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, S, P> JoinSemiLattice for IndexSet<T, S, P>

source§

fn join(&mut self, other: &Self) -> bool

Computes the least upper bound of two elements, storing the result in self and returning true if self has changed. Read more
source§

impl<T, S, P> PartialEq for IndexSet<T, S, P>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, S, P> Eq for IndexSet<T, S, P>

Auto Trait Implementations§

§

impl<T, S, P> RefUnwindSafe for IndexSet<T, S, P>

§

impl<T, S, P> Send for IndexSet<T, S, P>
where S: Send, <P as PointerFamily>::Pointer<IndexedDomain<T>>: Send,

§

impl<T, S, P> Sync for IndexSet<T, S, P>
where S: Sync, <P as PointerFamily>::Pointer<IndexedDomain<T>>: Sync,

§

impl<T, S, P> Unpin for IndexSet<T, S, P>

§

impl<T, S, P> UnwindSafe for IndexSet<T, S, P>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.