BitsPerFragment

Struct BitsPerFragment 

Source
pub struct BitsPerFragment(pub u8);
Expand description

BitsPerFragment represents the Huffman’s tree degree that is the power of two. It represents number of bits needed to store the degree. It can be used to construct minimum-redundancy coding whose codeword lengths are a multiple of this number of bits. It is faster than Degree and should be preferred for degrees that are the powers of two.

Tuple Fields§

§0: u8

Trait Implementations§

Source§

impl Clone for BitsPerFragment

Source§

fn clone(&self) -> BitsPerFragment

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<BitsPerFragment> for Degree

Source§

fn from(bits_per_fragment: BitsPerFragment) -> Self

Converts to this type from the input type.
Source§

impl Mul<u32> for BitsPerFragment

Source§

type Output = u32

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> Self::Output

Performs the * operation. Read more
Source§

impl TreeDegree for BitsPerFragment

Source§

fn as_u32(&self) -> u32

Returns the degree of the Huffman tree as u32.
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 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 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.
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

Source§

impl TryFrom<Degree> for BitsPerFragment

Source§

type Error = &'static str

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

fn try_from(value: Degree) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for BitsPerFragment

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.