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§
Sourcefn get_fragment(&self, bits: u32, fragment_nr: u32) -> u32
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().
Sourcefn pop_front(&self, bits: &mut u32) -> u32
fn pop_front(&self, bits: &mut u32) -> u32
Removes from bits and returns its fragment stored on least significant digit (bits).
Sourcefn code_capacity(&self) -> u8
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.
fn reverse_code(&self, bits: u32, len: u32) -> u32
Provided Methods§
Sourcefn write_size_bytes(&self) -> usize
fn write_size_bytes(&self) -> usize
Returns number of bytes that self.write writes to the output.
Sourcefn push_front(&self, bits: &mut u32, fragment: u32)
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.