pub trait RankBin {
// Required methods
fn rank1(&self, i: usize) -> Option<usize>;
unsafe fn rank1_unchecked(&self, i: usize) -> 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.
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.