1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! # compress-huffman-rs
//!
//! A pure-Rust Huffman coding compression library providing frequency analysis,
//! Huffman tree construction, canonical code generation, and round-trip
//! encode/decode.
//!
//! # Modules
//!
//! - [`frequency`] — Symbol frequency table construction and entropy computation.
//! - [`tree`] — Huffman tree building from frequency tables.
//! - [`canonical`] — Canonical Huffman code assignment and serialization helpers.
//! - [`encode`] — Bit-level encoding using Huffman codes.
//! - [`decode`] — Bit-level decoding using Huffman trees.
//!
//! # Quick Start
//!
//! ```
//! use compress_huffman_rs::{encode, decode, frequency, tree, canonical};
//!
//! let data = b"hello huffman";
//! let freq = frequency::FrequencyTable::from_data(data);
//! let htree = tree::HuffmanTree::from_frequency_table(&freq).unwrap();
//! // Use tree-derived codes for encoding (matches tree for decoding)
//! let codes = canonical::tree_codes(&htree);
//! let encoded = encode::encode_with_map(data, &codes);
//! let decoded = decode::decode(&encoded.bits, encoded.bit_length, &htree).unwrap();
//! assert_eq!(data.as_slice(), decoded.as_slice());
//! ```
use HashMap;
/// A Huffman code represented as (bits_value, bit_length).
pub type Code = ;
/// A mapping from byte symbols to their Huffman codes.
pub type CodeMap = ;
pub use FrequencyTable;
pub use HuffmanTree;
pub use CanonicalCodes;