pub trait SelectBin {
// Required methods
fn select1(&self, i: usize) -> Option<usize>;
unsafe fn select1_unchecked(&self, i: usize) -> usize;
fn select0(&self, i: usize) -> Option<usize>;
unsafe fn select0_unchecked(&self, i: usize) -> usize;
}Expand description
A trait for the support of select query over the binary alphabet.
Required Methods§
Sourcefn select1(&self, i: usize) -> Option<usize>
fn select1(&self, i: usize) -> Option<usize>
Returns the position of the i+1-th occurrence of a bit set to 1.
Returns None if there is no such position.
Sourceunsafe fn select1_unchecked(&self, i: usize) -> usize
unsafe fn select1_unchecked(&self, i: usize) -> usize
Returns the position of the i+1-th occurrence of a bit set to 1.
§Safety
This method doesn’t check that such element exists Calling this method with an i >= maximum rank1 is undefined behaviour.
Sourcefn select0(&self, i: usize) -> Option<usize>
fn select0(&self, i: usize) -> Option<usize>
Returns the position of the i+1-th occurrence of a bit set to 0.
Returns None if there is no such position.
Sourceunsafe fn select0_unchecked(&self, i: usize) -> usize
unsafe fn select0_unchecked(&self, i: usize) -> usize
Returns the position of the i+1-th occurrence of a bit set to 0.
§Safety
This method doesnt check that such element exists
Calling this method with an i >= maximum rank0 is undefined behaviour.