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
191
192
193
194
195
196
197
198
[]
= "structured-zstd"
= "0.0.31"
= "1.92"
= [
"Moritz Borcherding <moritz.borcherding@web.de>",
"Structured World Foundation <foundation@sw.foundation>",
]
= "2024"
= "Apache-2.0"
= "https://github.com/structured-world/structured-zstd"
= "https://github.com/structured-world/structured-zstd"
= "Pure Rust zstd implementation — managed fork of ruzstd. Dictionary decompression, no FFI."
= ["fuzz_decodecorpus/*", "decodecorpus_files/*", "dict_tests/files/**"]
# Package metadata points at a crate-local symlink so the packaged crate and repo root README stay in sync.
= "README.md"
= ["zstd", "zstandard", "decompression", "compression", "pure-rust"]
= ["compression"]
# docs.rs builds the crate with the public feature set so feature-gated
# items (e.g. the `dictionary` module behind `dict_builder`) appear in the
# published documentation. We list the public features explicitly rather
# than using `all-features = true` because the manifest also exposes
# `rustc-dep-of-std` (libstd-build-only — swaps in `rustc-std-workspace-*`
# crates), `bench_internals` (widens the API surface for benches), and
# `fuzz_exports` (widens it for fuzz targets); none of these should appear
# on docs.rs. The `--cfg docsrs` flag activates the
# `#[cfg_attr(docsrs, doc(cfg(...)))]` annotations that render feature
# badges on each item.
[]
= ["std", "hash", "dict_builder", "lsm"]
= ["--cfg", "docsrs"]
[]
# Locked behind the `hash` feature flag
= { = "2.0", = false, = ["xxhash64"], = true }
= { = "2.3.0", = true }
# Optional sync primitive for the FSE default-table cache on no-atomic
# targets (Cortex-M0/M0+, AVR, MSP430 — anywhere `target_has_atomic =
# "ptr"` is false). When this feature is enabled the cache uses a
# critical-section-protected `static mut` slot; when disabled the
# no-atomic build skips the cache entirely and returns an owned
# `Box<FSETable>` per call, dropped with the owning `FrameCompressor`
# (no leak — same memory shape as the pre-cache status quo on those
# targets). On targets with atomic pointer support (every modern
# desktop / server / mobile / Cortex-M3+ / RISC-V-A target) the dep
# is dead code and never instantiated — those targets use the lock-
# free `AtomicPtr` path unconditionally.
= { = "1.2", = true }
# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
= { = "0.1.2", = true }
= { = "1.0.0", = true, = "rustc-std-workspace-core" }
= { = "1.0.0", = true, = "rustc-std-workspace-alloc" }
[]
= "0.8"
= "0.10"
= { = "0.13.3", = ["zdict_builder", "experimental"] }
[]
= [
"hash",
"std",
"kernel_scalar",
"kernel_sse2",
"kernel_bmi2",
"kernel_avx2",
"kernel_vbmi2",
"kernel_neon",
"kernel_sve",
"kernel_simd128",
]
# Per-CPU-tier decode kernel selection. The default build enables every
# kernel; with `std`, `detect_cpu_kernel()` picks the best tier at runtime
# (CPU-feature detection) — a universal binary that adapts to any CPU. On
# `no_std` the tier is fixed at compile time from `target_feature`, baking
# the chosen ISA into the build. Constrained targets can trim the SIMD trampolines + their
# dispatch arms by disabling the tiers they don't need; the scalar kernel
# is always compiled as the fallback, so the lowest enabled tier always has
# a backstop. Each feature only affects builds for its architecture (a
# `kernel_avx2` flag is inert on aarch64, `kernel_neon` inert on x86), so
# the all-on default is safe everywhere. The implication chain mirrors the
# real ISA dependency: AVX2 implies BMI2 implies SSE2; SVE implies NEON.
# `kernel_scalar` is a marker only: the scalar kernel is compiled
# unconditionally (it is the mandatory fallback), so this flag gates no code.
# It exists so the scalar tier can be named explicitly in a feature set; a
# scalar-only build is equivalently `--no-default-features` (no SIMD tier
# enabled) or `--no-default-features --features kernel_scalar`.
= []
= []
= ["kernel_sse2"]
= ["kernel_bmi2"]
= ["kernel_avx2"]
= []
= ["kernel_neon"]
# WebAssembly fixed-128-bit SIMD tier (`simd128`). Inert on non-wasm targets
# the same way `kernel_neon` is inert on x86. wasm has no runtime CPU
# detection, so the tier is chosen at compile time from `target_feature =
# "simd128"`; consumers build with `-C target-feature=+simd128`. Covers the
# two 128-bit-class kernels that port directly (row tag-scan, match-copy);
# the 256-bit (AVX2/VBMI2) and scalar-bit-manip (BMI2) kernels have no
# simd128 equivalent and stay scalar on wasm.
= []
= ["std", "dep:fastrand"]
= ["dep:twox-hash"]
# Opt-in cache for FSE default tables on no-atomic targets. See
# `fse_encoder::default_*_table` for the implementation split. On
# targets with atomic pointer support this feature is a no-op.
= ["dep:critical-section"]
= []
= []
= []
# Diagnostic-only: atomic histograms of the match/literal copy shape on the
# decode path (call counts + size buckets + requested-vs-overshoot byte
# totals). Off in every shipping / bench build (zero codegen impact). Enabled
# by the `copy_shape` example to capture the copy-call distribution, which is
# deterministic from the compressed input and therefore architecture-
# independent (only the per-call timing is CPU-tier specific).
= ["std"]
# Diagnostic tracing of the Fast kernel's inner loop — per-iteration state
# dumps gated at compile time so production builds carry zero cost. Runtime
# activation via `STRUCTURED_ZSTD_KERNEL_TRACE=1` env var. Used by the
# `trace_fast_kernel` example for #220 ratio-divergence investigation.
= ["std"]
# Opt-in storage-format extensions: typed Rust APIs that downstream
# storage / wire-format consumers (lsm-tree, future graph stores) can
# layer on top of the spec-mandated zstd decoder behaviour. Default
# off, no C FFI symbols added regardless of this feature's state.
# Currently exposes:
# - expected-field validation setters on `FrameDecoder`
# (`expect_dict_id` / `expect_window_descriptor`) for wire-format
# consumers that need post-AEAD-decrypt sanity checks against a
# pinned `dict_id` / `window_descriptor`.
# - typed `SkippableFrame` builder + `write_skippable_frame` free
# function in `zstd::skippable` for RFC 8878 §3.1 skippable
# frames (16-variant magic + 4-byte LE length + payload).
# Other typed APIs land here over time as bilateral storage-format
# work expands the surface.
= []
# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
= ["dep:compiler_builtins", "dep:core", "dep:alloc"]
# Diagnostic example: only buildable with the copy-shape counters compiled
# in, so `--all-targets` on the default feature set skips it (the
# `shape_stats` re-export is feature-gated).
[[]]
= "copy_shape"
= ["copy_shape_stats", "dict_builder"]
[[]]
= "decode_all"
= false
[[]]
= "huf_decode_kernels"
= false
[[]]
= "compare_ffi"
= false
= ["dict_builder"]
[[]]
= "compare_ffi_memory"
= false
= ["dict_builder"]
[[]]
= "compare_ffi_sequences"
= false
= ["dict_builder", "bench_internals"]
[[]]
= "bitstream"
= false
= ["bench_internals"]
[[]]
= "dict_builder_fastcover"
= false
= ["dict_builder"]
[[]]
= "decode_dict_handle"
= false
[[]]
= "wildcopy_candidates"
= false
= ["bench_internals"]
[[]]
= "block_splitter_donor_parity"
= ["bench_internals"]