Expand description
hfmn is a library for huffman encoding and decoding of arbitrary symbols. It
supports code lengths up to std::mem::size_of::<usize>() * 8
bits.
§Nomenclature
- Symbol refers to your data, which can be of an arbitrary type
- Code refers to the prefix-free huffman code
§Examples
use hfmn::CodeBook;
let data_to_encode = "lorem ipsum dolor sit amet";
let codebook = CodeBook::from_data(&data_to_encode).unwrap();
let encoded_data = codebook.encode_data(&data_to_encode).unwrap();
let more_encoded_data = codebook.encode_data(&"optimum allied restrooms");
Structs§
Enums§
Functions§
- chain
- A convenience function to chain hfmn symbols into bytes.