Trait indexical::BitSet

source ·
pub trait BitSet: Clone + PartialEq {
    type Iter<'a>: Iterator<Item = usize>
       where Self: 'a;

Show 17 methods // Required methods fn empty(size: usize) -> Self; fn insert(&mut self, index: usize) -> bool; fn contains(&self, index: usize) -> bool; fn iter(&self) -> Self::Iter<'_>; fn len(&self) -> usize; fn union(&mut self, other: &Self); fn intersect(&mut self, other: &Self); fn subtract(&mut self, other: &Self); fn invert(&mut self); fn clear(&mut self); fn insert_all(&mut self); fn copy_from(&mut self, other: &Self); // Provided methods fn is_empty(&self) -> bool { ... } fn union_changed(&mut self, other: &Self) -> bool { ... } fn intersect_changed(&mut self, other: &Self) -> bool { ... } fn subtract_changed(&mut self, other: &Self) -> bool { ... } fn superset(&self, other: &Self) -> bool { ... }
}
Expand description

Interface for bit-set implementations.

Implement this trait if you want to provide a custom bit-set beneath the indexical abstractions.

Required Associated Types§

source

type Iter<'a>: Iterator<Item = usize> where Self: 'a

Type of iterator returned by iter.

Required Methods§

source

fn empty(size: usize) -> Self

Constructs a new bit-set with a domain of size size.

source

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

Sets index to 1, returning true if self changed.

source

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

Returns true if index is 1.

source

fn iter(&self) -> Self::Iter<'_>

Returns an iterator over all the indices of ones in the bit-set.

source

fn len(&self) -> usize

Returns the number of ones in the bit-set.

source

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

Adds all ones from other to self.

source

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

Removes all ones in self not in other.

source

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

Removes all ones from other in self.

source

fn invert(&mut self)

Flips all bits in self.

source

fn clear(&mut self)

Sets all bits to 0.

source

fn insert_all(&mut self)

Adds every element of the domain to self.

source

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

Copies other into self. Must have the same lengths.

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if there are no ones in the bit-set.

source

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

Adds all ones from other to self, returning true if self changed.

source

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

Removes all ones in self not in other, returning true if self changed.

source

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

Removes all ones from other in self, returning true if self changed.

source

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

Returns true if all ones in other are a one in self.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl BitSet for BitSet<usize>

§

type Iter<'a> = BitIter<'a, usize>