Trait qwt::RankQuad

source ·
pub trait RankQuad {
    // Required methods
    fn rank(&self, symbol: u8, i: usize) -> Option<usize>;
    unsafe fn rank_unchecked(&self, symbol: u8, i: usize) -> usize;
}
Expand description

A trait for the support of rank query over the alphabet [0..3].

Required Methods§

source

fn rank(&self, symbol: u8, i: usize) -> Option<usize>

Returns the number of occurrences in the indexed sequence of symbol up to position i excluded. None if the position is out of bound.

source

unsafe fn rank_unchecked(&self, symbol: u8, i: usize) -> usize

Returns the number of occurrences in the indexed sequence of symbol up to position i excluded. The function does not check boundaries.

§Safety

Calling this method with an out-of-bounds index or with a symbol larger than 3 is undefined behavior.

Implementors§