pub struct Encoder { /* private fields */ }Expand description
A huffman encoder that writes successive tables and data to pages
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn new(page_size: usize, page_threshold: usize) -> Encoder
pub fn new(page_size: usize, page_threshold: usize) -> Encoder
Create an encoder that writes into pages of page_size bytes
and rebuilds the frequency table every page_threshold pages.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Prepare the encoder for a new round of encoding this keeps allocations, so its cheaper than a Encoder::new call
Sourcepub async fn sink<E>(
&mut self,
byte: u8,
output: &mut impl PageWriter<E>,
) -> Result<bool, E>
pub async fn sink<E>( &mut self, byte: u8, output: &mut impl PageWriter<E>, ) -> Result<bool, E>
Put a byte into the encoder
Sourcepub async fn flush<E>(
&mut self,
output: &mut impl PageWriter<E>,
) -> Result<bool, E>
pub async fn flush<E>( &mut self, output: &mut impl PageWriter<E>, ) -> Result<bool, E>
Finish encoding and flush any remaining bytes
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
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