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
//! A pure-Rust reimplementation of [Zstandard](https://facebook.github.io/zstd/),
//! built to be **bit-exact** with the reference C implementation.
//!
//! Decompression is complete: dictionaries (raw-content and trained/`ZDICT`),
//! a configurable `windowLogMax`, and a [`Read`]-based [`StreamDecoder`] with
//! a bounded sliding window. [`compress`] produces frames **byte-identical to
//! C libzstd 1.5.7 at every level** (1–22 and the negative levels), and
//! [`StreamEncoder`] mirrors `ZSTD_compressStream2` flush/end behavior (see
//! its docs for the current streaming length scope). Every table and loop is
//! a faithful port of its counterpart in the C sources, and the crate is
//! continuously differential-tested against the real libzstd — see
//! `ROADMAP.md` for what remains.
//!
//! [`decompress`] and [`decompress_with_limit`] cover the common one-shot
//! cases; [`DecodeOptions`] composes an output limit, a maximum window log,
//! and a [`Dictionary`]; [`StreamDecoder`] decodes incrementally from any
//! reader.
//!
//! [`Read`]: std::io::Read
//!
//! ```
//! // A tiny handcrafted frame: single-segment, content size 5, one RLE
//! // block repeating `a` five times.
//! let frame = [0x28, 0xB5, 0x2F, 0xFD, 0x20, 0x05, 0x2B, 0x00, 0x00, b'a'];
//! assert_eq!(libzstd_bitexact_rs::decompress(&frame).unwrap(), b"aaaaa");
//! ```
pub use ;
pub use ;
pub use ;
pub use Dictionary;
pub use Error;
pub use StreamDecoder;
pub use StreamEncoder;