pub trait WTSupport: AccessQuad + RankQuad + SelectQuad {
// Required methods
fn occs(&self, symbol: u8) -> Option<usize>;
unsafe fn occs_unchecked(&self, symbol: u8) -> usize;
fn occs_smaller(&self, symbol: u8) -> Option<usize>;
unsafe fn rank_block_unchecked(&self, symbol: u8, i: usize) -> usize;
unsafe fn occs_smaller_unchecked(&self, symbol: u8) -> usize;
fn prefetch_info(&self, pos: usize);
fn prefetch_data(&self, pos: usize);
}
Expand description
A trait for the operations that a quad vector implementation needs to provide to be used in a Quad Wavelet Tree.
Required Methods§
sourcefn occs(&self, symbol: u8) -> Option<usize>
fn occs(&self, symbol: u8) -> Option<usize>
Returns the number of occurrences of symbol
in the indexed sequence,
None
if symbol
is larger than 3, i.e., symbol
is not valid.
sourceunsafe fn occs_unchecked(&self, symbol: u8) -> usize
unsafe fn occs_unchecked(&self, symbol: u8) -> usize
Returns the number of occurrences of symbol
in the indexed sequence.
Safety
Calling this method if the symbol
is larger than 3 (i.e., symbol
is not valid)
is undefined behavior.
sourcefn occs_smaller(&self, symbol: u8) -> Option<usize>
fn occs_smaller(&self, symbol: u8) -> Option<usize>
Returns the number of occurrences of all the symbols smaller than the
input symbol
, None
if symbol
is larger than 3,
i.e., symbol
is not valid.
sourceunsafe fn rank_block_unchecked(&self, symbol: u8, i: usize) -> usize
unsafe fn rank_block_unchecked(&self, symbol: u8, i: usize) -> usize
Returns the rank of symbol
up to the block that contains the position
i
.
Safety
Calling this method if the symbol
is larger than 3 of
if the position i
is out of bound is undefined behavior.
sourceunsafe fn occs_smaller_unchecked(&self, symbol: u8) -> usize
unsafe fn occs_smaller_unchecked(&self, symbol: u8) -> usize
Returns the number of occurrences of all the symbols smaller than the input
symbol
in the indexed sequence.
Safety
Calling this method if the symbol
is larger than 3 is undefined behavior.
sourcefn prefetch_info(&self, pos: usize)
fn prefetch_info(&self, pos: usize)
Prefetches counter of superblock and blocks containing the position pos
.
sourcefn prefetch_data(&self, pos: usize)
fn prefetch_data(&self, pos: usize)
Prefetches data containing the position pos
.