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

Builder of EliasFano.

Implementations

Creates a new EliasFanoBuilder.

Arguments
  • universe: The (exclusive) upper bound of integers to be stored, i.e., an integer in [0..universe - 1].
  • num_ints: The number of integers to be stored (> 0).
Errors

anyhow::Error will be returned if the given setting is invalid.

Pushes integer i at the end.

Arguments
  • i: Pushed integer that must be no less than the last one.
Errors

anyhow::Error will be returned if the input integer is invalid.

Example
use sucds::{EliasFano, EliasFanoBuilder};

let mut b = EliasFanoBuilder::new(10, 4).unwrap();
[2, 3, 6, 9].iter().for_each(|&x| b.push(x).unwrap());

let ef = EliasFano::new(b, false);
assert_eq!(ef.select(0), 2);
assert_eq!(ef.select(1), 3);
assert_eq!(ef.select(2), 6);
assert_eq!(ef.select(3), 9);

Appends integers at the end.

Arguments
  • ints: Pushed integers that are increasing.
Errors

anyhow::Error will be returned if the input integers are invalid.

Example
use sucds::{EliasFano, EliasFanoBuilder};

let mut b = EliasFanoBuilder::new(10, 4).unwrap();
b.append(&[2, 3, 6, 9]).unwrap();

let ef = EliasFano::new(b, false);
assert_eq!(ef.select(0), 2);
assert_eq!(ef.select(1), 3);
assert_eq!(ef.select(2), 6);
assert_eq!(ef.select(3), 9);

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.