RankBin

Trait RankBin 

Source
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§

Source

fn rank1(&self, i: usize) -> Option<usize>

Returns the number of ones in the indexed sequence up to position i excluded.

Source

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.

Source

fn n_zeros(&self) -> usize

Provided Methods§

Source

fn rank0(&self, i: usize) -> Option<usize>

Returns the number of zeros in the indexed sequence up to position i excluded.

Source

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.

Implementors§