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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! # tinybz2 — Minimal-memory bz2 for embedded targets
//!
//! A `no_std`, zero-dependency bz2 compressor and decompressor designed to run
//! on ESP32 and other memory-constrained microcontrollers.
//!
//! ## Design goals
//!
//! * **~110 KB peak RAM** at block size 1 (100 KB blocks) for both compress
//! and decompress — roughly 10× less than stock libbz2.
//! * **Zero heap allocation** — all working memory is caller-provided via
//! fixed-size workspace structs.
//! * **`no_std` + no `alloc`** — suitable for bare-metal and RTOS targets.
//! * **Streaming API** — process data in chunks without buffering the entire
//! input.
//!
//! ## Memory budget at block size 1 (100 000 bytes)
//!
//! | Component | Bytes |
//! |---------------------|----------|
//! | Block buffer | 100 000 |
//! | BWT workspace | 512 |
//! | MTF table | 256 |
//! | Huffman tables | 10 000 |
//! | Bookkeeping | 1 024 |
//! | **Total** | **~112 KB** |
extern crate std;
pub use ;
pub use ;
pub use Error;
/// One-shot compress into a caller-provided output buffer.
///
/// `block_size` must be 1..=9 (× 100 000 bytes).
/// Returns the number of bytes written to `output`, or an error.
/// One-shot decompress into a caller-provided output buffer.
///
/// Returns the number of bytes written to `output`, or an error.