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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
//! Pure-Rust Zstandard codec with a production-grade decoder, dictionary
//! handle reuse, and an actively-improved encoder.
//!
//! The crate ships:
//!
//! * [`decoding`] — [RFC 8878] decoder ([`decoding::StreamingDecoder`],
//! [`decoding::FrameDecoder`], dictionary-backed paths via
//! [`decoding::DictionaryHandle`]).
//! * [`encoding`] — frame compressor, streaming encoder, named and numeric
//! compression levels ([`encoding::CompressionLevel`]).
//! * [`dictionary`] (feature `dict_builder`) — COVER / FastCOVER training
//! plus raw-to-finalized dictionary helpers.
//!
//! No FFI, no cmake, no system zstd. `no_std` builds are supported by
//! disabling the default `std` feature.
//!
//! # CPU kernel features
//!
//! The decode hot paths ship per-CPU-tier SIMD kernels. With `std` the tier
//! is chosen at runtime (CPU-feature detection, cached on first use); on
//! `no_std` it is chosen at compile time from `cfg(target_feature)`.
//! Each tier is gated by a cargo feature, all enabled by default (a universal
//! binary that picks the best available tier per the above): `kernel_scalar`,
//! `kernel_sse2`, `kernel_bmi2`, `kernel_avx2`, `kernel_vbmi2` (x86) and
//! `kernel_neon`, `kernel_sve` (aarch64). The chain mirrors the ISA
//! dependency (`kernel_avx2` implies `kernel_bmi2` implies `kernel_sse2`;
//! `kernel_sve` implies `kernel_neon`). The scalar kernel is always compiled,
//! so any subset is valid; a flag is inert on architectures it doesn't apply
//! to. Constrained targets can shrink the binary by trimming tiers, e.g.
//! `--no-default-features --features kernel_scalar` compiles out the per-tier
//! SIMD kernel dispatch, its BMI2/AVX2/VBMI2/NEON trampolines, and the
//! explicit SSE2/NEON intrinsics in the small fixed-size copy primitives —
//! all of which are gated on the matching `kernel_*` feature. The `kernel_*`
//! features control the crate's own explicit SIMD; they do not constrain the
//! compiler's autovectorizer, which may still emit vector instructions from
//! ordinary scalar code regardless of the enabled tiers.
//!
//! The packaged README is included below for the docs.rs landing page; the
//! API anchors above link straight into the per-module documentation.
//!
//! [RFC 8878]: https://www.rfc-editor.org/rfc/rfc8878
// Keep crate docs aligned with the packaged README via the crate-local symlink in `zstd/README.md`.
extern crate std;
extern crate alloc;
pub const VERBOSE: bool = false;
/// Smallest accepted block-size target (the `ZSTD_TARGETCBLOCKSIZE_MIN`
/// bound): the single source of truth shared by the Rust setters
/// (`set_target_block_size`) and the C ABI parameter surface.
pub use MIN_TARGET_BLOCK_SIZE;
pub
// `pub fn init_state<K: CpuKernel>` and friends inside the
// fuzz_exports-public `huff0` module name `crate::cpu_kernel::CpuKernel`
// in their signatures. Without a publicly-reachable path to `CpuKernel`
// the bound triggers `private_bounds` / `private_interfaces`. Re-export
// under the same feature gate so the fuzz harness build is clean.
pub use crate;
/// Name of the active CPU kernel tier (entropy / sequence hot paths) for this
/// process — for diagnostics and benchmark/dashboard reporting. See
/// [`cpu_kernel::active_cpu_kernel_name`].
pub use crateactive_cpu_kernel_name;
pub
pub
pub use io_std as io;
pub use io_nostd as io;
/// Re-exports of internal types used by benchmarks.
///
/// Gated behind the `bench_internals` feature so normal builds do not
/// widen the public API surface. Not part of the stable API; items may
/// change or disappear without notice.
/// SIMD wildcopy overshoot slack carried by every decoder backend
/// (currently **32 bytes**). Sized so the AVX2 chunked kernel in
/// `simd_copy::copy_bytes_overshooting` (32-byte stride on x86-64) can
/// fire on tail copies near the end of a fixed-capacity output buffer.
/// Donor zstd's `WILDCOPY_OVERLENGTH` is also 32 bytes today; this
/// matches that contract.
///
/// Public so callers sizing an output slice for
/// [`crate::decoding::FrameDecoder::decode_all`] can size
/// `frame_content_size + WILDCOPY_OVERLENGTH` symbolically without
/// duplicating the value. Use the const reference rather than a
/// hardcoded literal — `simd_copy::copy_bytes_overshooting` already
/// ships an AVX-512 64-byte chunked kernel, and the slack may grow
/// further to reliably enable that wider kernel at buffer tails
/// (mirroring how the bump from 16 → 32 enabled the AVX2 32-byte
/// kernel at the tail).
pub const WILDCOPY_OVERLENGTH: usize = crateWILDCOPY_OVERLENGTH;