pub trait RankBin {
// Required methods
fn rank1(&self, i: usize) -> Option<usize>;
unsafe fn rank1_unchecked(&self, i: usize) -> usize;
fn n_zeros(&self) -> usize;
// Provided methods
fn rank0(&self, i: usize) -> Option<usize> { ... }
unsafe fn rank0_unchecked(&self, i: usize) -> usize { ... }
}Expand description
A trait for the support of rank query over the binary alphabet.
Required Methods§
Sourcefn rank1(&self, i: usize) -> Option<usize>
fn rank1(&self, i: usize) -> Option<usize>
Returns the number of ones in the indexed sequence up to
position i excluded.
Sourceunsafe fn rank1_unchecked(&self, i: usize) -> usize
unsafe fn rank1_unchecked(&self, i: usize) -> usize
Returns the number of ones in the indexed sequence up to
position i excluded. None if the position is out of bound.
§Safety
Calling this method with an out-of-bounds index is undefined behavior.
fn n_zeros(&self) -> usize
Provided Methods§
Sourcefn rank0(&self, i: usize) -> Option<usize>
fn rank0(&self, i: usize) -> Option<usize>
Returns the number of zeros in the indexed sequence up to
position i excluded.
Sourceunsafe fn rank0_unchecked(&self, i: usize) -> usize
unsafe fn rank0_unchecked(&self, i: usize) -> usize
Returns the number of zeros in the indexed sequence up to
position i excluded.
§Safety
Calling this method with an out-of-bounds index is undefined behavior.