pub struct IntVecFromIterBuilder<T: Storable, E: Endianness, I: IntoIterator<Item = T>> { /* private fields */ }Expand description
A builder for creating an IntVec from an iterator.
This builder is designed for constructing an IntVec from a data source that
is an iterator. It consumes the iterator and compresses its elements on the fly.
It is obtained by calling IntVec::from_iter_builder.
§Limitations
This builder does not support automatic codec selection (i.e., VariableCodecSpec::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>> IntVecFromIterBuilder<T, E, I>
impl<T: Storable, E: Endianness, I: IntoIterator<Item = T>> IntVecFromIterBuilder<T, E, I>
Sourcepub fn codec(self, codec_spec: VariableCodecSpec) -> Self
pub fn codec(self, codec_spec: VariableCodecSpec) -> 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., VariableCodecSpec::Auto).
Sourcepub fn build(self) -> Result<IntVec<T, E, Vec<u64>>, IntVecError>where
BufBitWriter<E, MemWordWriterVec<u64, Vec<u64>>>: BitWrite<E, Error = Infallible> + CodesWrite<E>,
pub fn build(self) -> Result<IntVec<T, E, Vec<u64>>, IntVecError>where
BufBitWriter<E, MemWordWriterVec<u64, Vec<u64>>>: BitWrite<E, Error = Infallible> + CodesWrite<E>,
Builds the IntVec 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 IntVecError if an automatic codec spec is used or if k is 0.
§Examples
use compressed_intvec::variable::{IntVec, UIntVec, VariableCodecSpec};
// Create a vector from a range iterator
let data_iter = 0..1000u32;
let vec: UIntVec<u32> = IntVec::from_iter_builder(data_iter)
.k(64)
.codec(VariableCodecSpec::Gamma) // Must be specified
.build()
.unwrap();
assert_eq!(vec.len(), 1000);
assert_eq!(vec.get(999), Some(999));Trait Implementations§
Auto Trait Implementations§
impl<T, E, I> Freeze for IntVecFromIterBuilder<T, E, I>where
I: Freeze,
impl<T, E, I> RefUnwindSafe for IntVecFromIterBuilder<T, E, I>
impl<T, E, I> Send for IntVecFromIterBuilder<T, E, I>
impl<T, E, I> Sync for IntVecFromIterBuilder<T, E, I>
impl<T, E, I> Unpin for IntVecFromIterBuilder<T, E, I>
impl<T, E, I> UnwindSafe for IntVecFromIterBuilder<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