[−][src]Struct huffman_compress::Book
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]
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
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,