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>
impl<'t> HuffmanDecoder<'t>
Sourcepub fn new(table: &'t HuffmanTable) -> HuffmanDecoder<'t>
pub fn new(table: &'t HuffmanTable) -> HuffmanDecoder<'t>
Create a new decoder with the provided table
Sourcepub fn reset(self, new_table: Option<&'t HuffmanTable>)
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.
Sourcepub fn decode_symbol(&mut self) -> u8
pub fn decode_symbol(&mut self) -> u8
Decode the symbol the internal state (cursor) is pointed at and return the decoded literal.
Sourcepub fn init_state(&mut self, br: &mut BitReaderReversed<'_>) -> u8
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.
Sourcepub fn next_state(&mut self, br: &mut BitReaderReversed<'_>) -> u8
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> 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