TreeDegree

Trait TreeDegree 

Source
pub trait TreeDegree:
    Sized
    + Copy
    + Mul<u32, Output = u32> {
    // Required methods
    fn as_u32(&self) -> u32;
    fn read(input: &mut dyn Read) -> Result<Self>;
    fn get_fragment(&self, bits: u32, fragment_nr: u32) -> u32;
    fn pop_front(&self, bits: &mut u32) -> u32;
    fn code_capacity(&self) -> u8;
    fn reverse_code(&self, bits: u32, len: u32) -> u32;

    // Provided methods
    fn write_size_bytes(&self) -> usize { ... }
    fn write(&self, output: &mut dyn Write) -> Result<()> { ... }
    fn push_front(&self, bits: &mut u32, fragment: u32) { ... }
}
Expand description

Represents the degree of the Huffman tree, which is equal to the number of different values of a single codeword fragment.

Required Methods§

Source

fn as_u32(&self) -> u32

Returns the degree of the Huffman tree as u32.

Source

fn read(input: &mut dyn Read) -> Result<Self>

Reads Self from input.

Source

fn get_fragment(&self, bits: u32, fragment_nr: u32) -> u32

Returns the fragment_nr-th fragment of bits. Result is less than self.tree_degree().

Source

fn pop_front(&self, bits: &mut u32) -> u32

Removes from bits and returns its fragment stored on least significant digit (bits).

Source

fn code_capacity(&self) -> u8

Returns the largest number of fragments that can be explicitly stored in the code. Longer codes begin with a sequence of zeros and only their last fragments are explicitly represented.

Source

fn reverse_code(&self, bits: u32, len: u32) -> u32

Provided Methods§

Source

fn write_size_bytes(&self) -> usize

Returns number of bytes that self.write writes to the output.

Source

fn write(&self, output: &mut dyn Write) -> Result<()>

Writes self to output.

Source

fn push_front(&self, bits: &mut u32, fragment: u32)

Appends the fragment (that must be less than self.tree_degree) to the least significant digit (bits) of bits.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§