IndexSet

Trait IndexSet 

Source
pub trait IndexSet {
    // Required methods
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
    fn insert(&mut self, index: usize);
    fn remove(&mut self, index: usize);
    fn contains(&self, index: usize) -> bool;
    fn iter(&self) -> impl Iterator<Item = usize> + '_;
    fn union(&mut self, other: &Self);

    // Provided method
    fn reserve(&mut self, _size: usize) { ... }
}
Expand description

Public interface of any index set implementation.

Required Methods§

Source

fn len(&self) -> usize

Return the number of usize values present in this IndexSet.

Source

fn is_empty(&self) -> bool

Checks if this IndexSet has no inner indexes stored within.

Source

fn insert(&mut self, index: usize)

Add a new index to this IndexSet.

Source

fn remove(&mut self, index: usize)

Remove an index from this IndexSet.

Source

fn contains(&self, index: usize) -> bool

Check the presence of an index in this IndexSet.

Source

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

Return an iterator over the indices in this IndexSet, in ascending order.

Source

fn union(&mut self, other: &Self)

Merge two IndexSet instances.

Corresponds to a mutating set union operation, between self and other.

Provided Methods§

Source

fn reserve(&mut self, _size: usize)

Attempt to reserve space for the specified number of additional usize elements.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S: Storage> IndexSet for BTreeIndexSet<S>

Source§

impl<S: Storage> IndexSet for VecIndexSet<S>