pub struct VarVecFromIterBuilder<T: Storable, E: Endianness, I: IntoIterator<Item = T>> { /* private fields */ }Expand description
A builder for creating an VarVec from an iterator.
This builder is designed for constructing an VarVec from a data source that
is an iterator. It consumes the iterator and compresses its elements on the fly.
It is obtained by calling VarVec::from_iter_builder.
§Limitations
This builder does not support automatic codec selection (i.e., Codec::Auto)
or automatic parameter estimation for codecs like Rice or Golomb. Since the
iterator is consumed in a single pass, the data cannot be pre-analyzed to
determine its statistical properties. The user must specify a concrete codec.
Implementations§
Source§impl<T: Storable, E: Endianness, I: IntoIterator<Item = T>> VarVecFromIterBuilder<T, E, I>
impl<T: Storable, E: Endianness, I: IntoIterator<Item = T>> VarVecFromIterBuilder<T, E, I>
Sourcepub fn codec(self, codec_spec: Codec) -> Self
pub fn codec(self, codec_spec: Codec) -> Self
Sets the compression codec to use.
§Errors
The build method will return an error if a codec specification that
requires data analysis is provided (e.g., Codec::Auto).
Sourcepub fn build(self) -> Result<VarVec<T, E, Vec<u64>>, VarVecError>where
BufBitWriter<E, MemWordWriterVec<u64, Vec<u64>>>: BitWrite<E, Error = Infallible> + CodesWrite<E>,
pub fn build(self) -> Result<VarVec<T, E, Vec<u64>>, VarVecError>where
BufBitWriter<E, MemWordWriterVec<u64, Vec<u64>>>: BitWrite<E, Error = Infallible> + CodesWrite<E>,
Builds the VarVec by consuming the iterator.
This method iterates through the provided data source, compresses it, and builds the sampling table in a single pass.
§Errors
Returns an VarVecError if an automatic codec spec is used or if k is 0.
§Examples
use compressed_intvec::variable::{VarVec, UVarVec, Codec};
// Create a vector from a range iterator
let data_iter = 0..1000u32;
let vec: UVarVec<u32> = VarVec::from_iter_builder(data_iter)
.k(64)
.codec(Codec::Gamma) // Must be specified
.build()?;
assert_eq!(vec.len(), 1000);
assert_eq!(vec.get(999), Some(999));Trait Implementations§
Auto Trait Implementations§
impl<T, E, I> Freeze for VarVecFromIterBuilder<T, E, I>where
I: Freeze,
impl<T, E, I> RefUnwindSafe for VarVecFromIterBuilder<T, E, I>
impl<T, E, I> Send for VarVecFromIterBuilder<T, E, I>
impl<T, E, I> Sync for VarVecFromIterBuilder<T, E, I>
impl<T, E, I> Unpin for VarVecFromIterBuilder<T, E, I>
impl<T, E, I> UnsafeUnpin for VarVecFromIterBuilder<T, E, I>where
I: UnsafeUnpin,
impl<T, E, I> UnwindSafe for VarVecFromIterBuilder<T, E, I>
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
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more