pub(crate) struct HuffmanTree(HuffmanTreeInner);
Expand description
Huffman tree
Tuple Fields§
§0: HuffmanTreeInner
Implementations§
Source§impl HuffmanTree
impl HuffmanTree
Sourcepub(crate) fn build_implicit(
code_lengths: Vec<u16>,
) -> Result<Self, DecodingError>
pub(crate) fn build_implicit( code_lengths: Vec<u16>, ) -> Result<Self, DecodingError>
Builds a tree implicitly, just from code lengths
pub(crate) const fn build_single_node(symbol: u16) -> Self
pub(crate) fn build_two_node(zero: u16, one: u16) -> Self
pub(crate) const fn is_single_node(&self) -> bool
fn read_symbol_slowpath<R: BufRead>( tree: &[HuffmanTreeNode], v: usize, start_index: usize, bit_reader: &mut BitReader<R>, ) -> Result<u16, DecodingError>
Sourcepub(crate) fn read_symbol<R: BufRead>(
&self,
bit_reader: &mut BitReader<R>,
) -> Result<u16, DecodingError>
pub(crate) fn read_symbol<R: BufRead>( &self, bit_reader: &mut BitReader<R>, ) -> Result<u16, DecodingError>
Reads a symbol using the bit reader.
You must call call bit_reader.fill()
before calling this function or it may erroroneosly
detect the end of the stream and return a bitstream error.
Sourcepub(crate) fn peek_symbol<R: BufRead>(
&self,
bit_reader: &BitReader<R>,
) -> Option<(u8, u16)>
pub(crate) fn peek_symbol<R: BufRead>( &self, bit_reader: &BitReader<R>, ) -> Option<(u8, u16)>
Peek at the next symbol in the bitstream if it can be read with only a primary table lookup.
Returns a tuple of the codelength and symbol value. This function may return wrong information if there aren’t enough bits in the bit reader to read the next symbol.
Trait Implementations§
Source§impl Clone for HuffmanTree
impl Clone for HuffmanTree
Source§fn clone(&self) -> HuffmanTree
fn clone(&self) -> HuffmanTree
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for HuffmanTree
impl Debug for HuffmanTree
Auto Trait Implementations§
impl Freeze for HuffmanTree
impl RefUnwindSafe for HuffmanTree
impl Send for HuffmanTree
impl Sync for HuffmanTree
impl Unpin for HuffmanTree
impl UnwindSafe for HuffmanTree
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