Trait BitSetInterface

Source
pub unsafe trait BitSetInterface:
    BitSetBase
    + LevelMasksIterExt
    + IntoIterator<IntoIter = IndexIter<Self>>
    + Sized {
    // Provided methods
    fn block_iter(&self) -> BlockIter<&Self>  { ... }
    fn iter(&self) -> IndexIter<&Self>  { ... }
    fn into_block_iter(self) -> BlockIter<Self>  { ... }
    fn contains(&self, index: usize) -> bool { ... }
    fn is_empty(&self) -> bool { ... }
}
Expand description

Bitset interface.

Implemented for bitset references and optionally for values. So as argument - accept BitSetInterface by value. (Act as kinda forwarding reference in C++)

§Traversing

BlockIter and IndexIter have specialized for_each() implementation and traverse().

Like with most Rust iterators, traversing1 is somewhat faster then iteration. In this particular case, it has noticeable difference in micro-benchmarks. Remember, that iteration is already super-fast, and any tiny change become important at that scale. Hence, this will have effect in really tight loops (like incrementing counter).


  1. Under “traverse” we understand function application for each element of bitset. 

Provided Methods§

Source

fn block_iter(&self) -> BlockIter<&Self>

Source

fn iter(&self) -> IndexIter<&Self>

Source

fn into_block_iter(self) -> BlockIter<Self>

Source

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

Source

fn is_empty(&self) -> bool

O(1) if TRUSTED_HIERARCHY, O(N) otherwise.

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<Conf> BitSetInterface for &BitSet<Conf>
where Conf: Config,

Source§

impl<Op, S1, S2> BitSetInterface for &Apply<Op, S1, S2>
where Op: BitSetOp, S1: BitSetInterface, S2: BitSetInterface<Conf = S1::Conf>,

Source§

impl<Op, S1, S2> BitSetInterface for Apply<Op, S1, S2>
where Op: BitSetOp, S1: BitSetInterface, S2: BitSetInterface<Conf = S1::Conf>,

Source§

impl<Op, S, Cache> BitSetInterface for &Reduce<Op, S, Cache>
where Op: BitSetOp, S: Iterator + Clone, S::Item: BitSetInterface, Cache: ReduceCache,

Source§

impl<Op, S, Cache> BitSetInterface for Reduce<Op, S, Cache>
where Op: BitSetOp, S: Iterator + Clone, S::Item: BitSetInterface, Cache: ReduceCache,