pub trait Rank {
// Required method
fn try_rank(&self, index: usize) -> Option<usize>;
// Provided methods
fn rank(&self, index: usize) -> usize { ... }
unsafe fn rank_unchecked(&self, index: usize) -> usize { ... }
fn try_rank0(&self, index: usize) -> Option<usize> { ... }
fn rank0(&self, index: usize) -> usize { ... }
unsafe fn rank0_unchecked(&self, index: usize) -> usize { ... }
}Expand description
Trait for rank queries on bit vector. Rank query returns the number of ones (or zeros) in requested number of the first bits.
Required Methods§
Provided Methods§
Sourcefn rank(&self, index: usize) -> usize
fn rank(&self, index: usize) -> usize
Returns the number of ones in first index bits or panics if index is out of bounds.
Sourceunsafe fn rank_unchecked(&self, index: usize) -> usize
unsafe fn rank_unchecked(&self, index: usize) -> usize
Returns the number of ones in first index bits.
The result is undefined if index is out of bounds.
Sourcefn try_rank0(&self, index: usize) -> Option<usize>
fn try_rank0(&self, index: usize) -> Option<usize>
Returns the number of zeros in first index bits or None if index is out of bounds.
Sourcefn rank0(&self, index: usize) -> usize
fn rank0(&self, index: usize) -> usize
Returns the number of zeros in first index bits or panics if index is out of bounds.
Sourceunsafe fn rank0_unchecked(&self, index: usize) -> usize
unsafe fn rank0_unchecked(&self, index: usize) -> usize
Returns the number of ones in first index bits.
The result is undefined if index is out of bounds.