Struct sucds::mii_sequences::elias_fano::EliasFanoBuilder
source · pub struct EliasFanoBuilder { /* private fields */ }
Expand description
Builder for EliasFano
.
Examples
use sucds::mii_sequences::EliasFanoBuilder;
let mut efb = EliasFanoBuilder::new(8, 5)?;
assert_eq!(efb.universe(), 8);
assert_eq!(efb.num_vals(), 5);
efb.push(1)?;
efb.push(3)?;
efb.extend([3, 5, 7])?;
let ef = efb.build();
assert_eq!(ef.len(), 5);
assert_eq!(ef.universe(), 8);
Implementations§
source§impl EliasFanoBuilder
impl EliasFanoBuilder
sourcepub fn push(&mut self, val: usize) -> Result<()>
pub fn push(&mut self, val: usize) -> Result<()>
Pushes integer val
at the end.
Arguments
val
: Pushed integer that must be no less than the last one.
Errors
An error is returned if
val
is less than the last one,val
is no less thanSelf::universe()
, or- the number of stored integers becomes no less than
Self::num_vals()
.
sourcepub fn extend<I>(&mut self, vals: I) -> Result<()>where
I: IntoIterator<Item = usize>,
pub fn extend<I>(&mut self, vals: I) -> Result<()>where I: IntoIterator<Item = usize>,
Appends integers at the end.
Arguments
vals
: Pushed integers that are monotone increasing.
Errors
An error is returned if
vals
is not monotone increasing (also compared to the current last value),- values in
vals
is no less thanSelf::universe()
, or - the number of stored integers becomes no less than
Self::num_vals()
.
Auto Trait Implementations§
impl RefUnwindSafe for EliasFanoBuilder
impl Send for EliasFanoBuilder
impl Sync for EliasFanoBuilder
impl Unpin for EliasFanoBuilder
impl UnwindSafe for EliasFanoBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more