Struct HuffmanDecoder

Source
pub struct HuffmanDecoder<'table> {
    pub state: u64,
    /* private fields */
}
Expand description

An interface around a huffman table used to decode data.

Fields§

§state: u64

State is used to index into the table.

Implementations§

Source§

impl<'t> HuffmanDecoder<'t>

Source

pub fn new(table: &'t HuffmanTable) -> HuffmanDecoder<'t>

Create a new decoder with the provided table

Source

pub fn reset(self, new_table: Option<&'t HuffmanTable>)

Re-initialize the decoder, using the new table if one is provided. This might used for treeless blocks, because they re-use the table from old data.

Source

pub fn decode_symbol(&mut self) -> u8

Decode the symbol the internal state (cursor) is pointed at and return the decoded literal.

Source

pub fn init_state(&mut self, br: &mut BitReaderReversed<'_>) -> u8

Initialize internal state and prepare to decode data. Then, decode_symbol can be called to read the byte the internal cursor is pointing at, and next_state can be called to advance the cursor until the max number of bits has been read.

Source

pub fn next_state(&mut self, br: &mut BitReaderReversed<'_>) -> u8

Advance the internal cursor to the next symbol. After this, you can call decode_symbol to read from the new position.

Auto Trait Implementations§

§

impl<'table> Freeze for HuffmanDecoder<'table>

§

impl<'table> RefUnwindSafe for HuffmanDecoder<'table>

§

impl<'table> Send for HuffmanDecoder<'table>

§

impl<'table> Sync for HuffmanDecoder<'table>

§

impl<'table> Unpin for HuffmanDecoder<'table>

§

impl<'table> UnwindSafe for HuffmanDecoder<'table>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.