Trait hibitset::BitSetLike
source · pub trait BitSetLike {
// Required methods
fn layer3(&self) -> usize;
fn layer2(&self, i: usize) -> usize;
fn layer1(&self, i: usize) -> usize;
fn layer0(&self, i: usize) -> usize;
fn contains(&self, i: u32) -> bool;
// Provided methods
fn get_from_layer(&self, layer: usize, idx: usize) -> usize { ... }
fn is_empty(&self) -> bool { ... }
fn iter(self) -> BitIter<Self> ⓘ
where Self: Sized { ... }
fn par_iter(self) -> BitParIter<Self>
where Self: Sized { ... }
}
Expand description
A generic interface for BitSetLike
-like types.
Every BitSetLike
is hierarchical, meaning that there
are multiple levels that branch out in a tree like structure.
Layer0 each bit represents one Index of the set
Layer1 each bit represents one usize
of Layer0, and will be
set only if the word below it is not zero.
Layer2 has the same arrangement but with Layer1, and Layer3 with Layer2.
This arrangement allows for rapid jumps across the key-space.
Required Methods§
sourcefn layer3(&self) -> usize
fn layer3(&self) -> usize
Return a usize
where each bit represents if any word in layer2
has been set.
sourcefn layer2(&self, i: usize) -> usize
fn layer2(&self, i: usize) -> usize
Return the usize
from the array of usizes that indicates if any
bit has been set in layer1
sourcefn layer1(&self, i: usize) -> usize
fn layer1(&self, i: usize) -> usize
Return the usize
from the array of usizes that indicates if any
bit has been set in layer0
Provided Methods§
sourcefn get_from_layer(&self, layer: usize, idx: usize) -> usize
fn get_from_layer(&self, layer: usize, idx: usize) -> usize
Gets the usize
corresponding to layer and index.
The layer
should be in the range [0, 3]
sourcefn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns true if this BitSetLike
contains nothing, and false otherwise.
sourcefn iter(self) -> BitIter<Self> ⓘwhere
Self: Sized,
fn iter(self) -> BitIter<Self> ⓘwhere
Self: Sized,
Create an iterator that will scan over the keyspace
sourcefn par_iter(self) -> BitParIter<Self>where
Self: Sized,
fn par_iter(self) -> BitParIter<Self>where
Self: Sized,
Create a parallel iterator that will scan over the keyspace