Struct huffman_compress::Book
[−]
[src]
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]
K: Borrow<Q>,
Q: Ord,
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]
K: Borrow<Q>,
Q: Ord,
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]
&self,
buffer: &mut BitVec,
k: &Q
) -> Result<(), EncodeError> where
K: Borrow<Q>,
Q: Ord,
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(&self) -> Book<K>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more