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).
Under “traverse” we understand function application for each element of bitset. ↩
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
Sourcefn is_empty(&self) -> bool
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.