pub struct WaveletMatrixBuilder { /* private fields */ }
Expand description

Builder of WaveletMatrix.

Implementations

Creates a new WaveletMatrixBuilder.

Pusheds integer val at the end

Arguments
  • val : Integer to be pushed.
Examples
use sucds::{WaveletMatrix, WaveletMatrixBuilder};

let mut wmb = WaveletMatrixBuilder::new();
let text = "tobeornottobethatisthequestion";
text.chars().for_each(|c| wmb.push(c as usize));

let wm = wmb.build().unwrap();
assert_eq!(wm.len(), text.chars().count());
assert_eq!(wm.dim(), ('u' as usize) + 1);

assert_eq!(wm.get(20), 'h' as usize);
assert_eq!(wm.rank(22, 'o' as usize), 4);
assert_eq!(wm.select(2, 't' as usize), 9);

Builds WaveletMatrix from a sequence of pushed integers.

Errors

anyhow::Error will be returned if self.vals is empty

Examples
use sucds::{WaveletMatrix, WaveletMatrixBuilder};

let mut wmb = WaveletMatrixBuilder::new();
let text = "tobeornottobethatisthequestion";
text.chars().for_each(|c| wmb.push(c as usize));

let wm = wmb.build().unwrap();
assert_eq!(wm.len(), text.chars().count());
assert_eq!(wm.dim(), ('u' as usize) + 1);

assert_eq!(wm.get(20), 'h' as usize);
assert_eq!(wm.rank(22, 'o' as usize), 4);
assert_eq!(wm.select(2, 't' as usize), 9);

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.