[][src]Struct huffman_compress::Book

pub struct Book<K> { /* fields omitted */ }

A codebook used for encoding.

Methods

impl<K: Ord + Clone> Book<K>[src]

pub fn into_inner(self) -> BTreeMap<K, BitVec>[src]

Returns the underlying B-Tree.

pub fn symbols(&self) -> Keys<K, BitVec>[src]

An iterator over all symbols in sorted order.

pub fn iter(&self) -> Iter<K, BitVec>[src]

An iterator over all symbol and code word pairs, sorted by symbol.

pub fn len(&self) -> usize[src]

Returns the number of symbols in the book.

pub fn is_empty(&self) -> bool[src]

Returns true if the map has no symbols.

pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&BitVec> where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns the code word for a given symbol.

pub fn contains_symbol<Q: ?Sized>(&self, k: &Q) -> bool where
    K: Borrow<Q>,
    Q: Ord
[src]

Returns true if the book contains the specified symbol.

pub fn encode<Q: ?Sized>(
    &self,
    buffer: &mut BitVec,
    k: &Q
) -> Result<(), EncodeError> where
    K: Borrow<Q>,
    Q: Ord
[src]

Writes the code word for the given key to a bit vector.

Errors

Returns EncodeError if k is not in the codebook.

Trait Implementations

impl<K: Clone> Clone for Book<K>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<K: Debug> Debug for Book<K>[src]

Auto Trait Implementations

impl<K> Send for Book<K> where
    K: Send

impl<K> Sync for Book<K> where
    K: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]