pub struct StreamingEncoder<'a, W: Write> { /* private fields */ }Expand description
Streaming encoder for processing large amounts of data efficiently.
Processes data in chunks to avoid loading entire files into memory. Suitable for encoding large files or network streams. Supports optional compression and hashing during encoding.
Implementations§
Source§impl<'a, W: Write> StreamingEncoder<'a, W>
impl<'a, W: Write> StreamingEncoder<'a, W>
Sourcepub fn new(dictionary: &'a Dictionary, writer: W) -> Self
pub fn new(dictionary: &'a Dictionary, writer: W) -> Self
Creates a new streaming encoder.
§Arguments
dictionary- The dictionary to use for encodingwriter- The destination for encoded output
Sourcepub fn with_compression(self, algo: CompressionAlgorithm, level: u32) -> Self
pub fn with_compression(self, algo: CompressionAlgorithm, level: u32) -> Self
Sets compression algorithm and level.
Sourcepub fn with_hashing(self, algo: HashAlgorithm) -> Self
pub fn with_hashing(self, algo: HashAlgorithm) -> Self
Sets hash algorithm for computing hash during encoding.
Sourcepub fn with_xxhash_config(self, config: XxHashConfig) -> Self
pub fn with_xxhash_config(self, config: XxHashConfig) -> Self
Sets xxHash configuration (seed and secret).
Sourcepub fn encode<R: Read>(&mut self, reader: &mut R) -> Result<Option<Vec<u8>>>
pub fn encode<R: Read>(&mut self, reader: &mut R) -> Result<Option<Vec<u8>>>
Encodes data from a reader in chunks.
Note: Radix mode requires reading the entire input at once due to the nature of true base conversion. For truly streaming behavior, use Chunked or ByteRange modes.
Returns the computed hash if hash_algo was set, otherwise None.
Auto Trait Implementations§
impl<'a, W> Freeze for StreamingEncoder<'a, W>where
W: Freeze,
impl<'a, W> RefUnwindSafe for StreamingEncoder<'a, W>where
W: RefUnwindSafe,
impl<'a, W> Send for StreamingEncoder<'a, W>where
W: Send,
impl<'a, W> Sync for StreamingEncoder<'a, W>where
W: Sync,
impl<'a, W> Unpin for StreamingEncoder<'a, W>where
W: Unpin,
impl<'a, W> UnwindSafe for StreamingEncoder<'a, W>where
W: UnwindSafe,
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