pub struct CodecCaps {
pub encode: bool,
pub decode: bool,
pub parallel_encode: bool,
pub parallel_decode: bool,
pub frame_index: bool,
pub detects_corruption: CorruptionDetection,
pub memory_per_worker: Option<u64>,
pub weak_encoder: bool,
}Expand description
What a codec can do. Every field defaults to false (or, for
detects_corruption, its equivalent conservative variant): a backend must
opt in.
Fields§
§encode: bool§decode: bool§parallel_encode: bool§parallel_decode: bool§frame_index: boolStream carries a frame/block index enabling random access.
detects_corruption: CorruptionDetectionSee CorruptionDetection for what each state promises.
memory_per_worker: Option<u64>Rough working-set cost of one encode worker, in bytes, when the codec
knows it. None means unknown — assume modest.
A static, conservative HIGH figure for callers who introspect
CodecCaps without encoding anything (property 12’s own governor
sizing, and each codec’s clamp test) — it is not what the governor
actually divides by during a real encode. The four codecs Phase 1f
gave a multi-threaded encoder (zstd-c, xz-c, xz-pure, lzip)
each call their own level-aware per_worker_bytes(level) for that,
because the true cost varies by preset (roughly 128 MiB below preset
7, ~896 MiB at 7 and above, for xz and lzip) and this field’s
contract is to round up to a single figure that covers every level a
caller might ask for.
weak_encoder: boolThis build’s encoder for the format is markedly worse than the format’s usual one — a fallback that produces valid output nobody would choose.
ops refuses to use it unless the caller opts in, because the output is
indistinguishable afterwards: a user who asked for .xz expects xz
ratios, and two builds of stuffr would otherwise produce very different
files from an identical command with no way to tell which they got.
Implementations§
Source§impl CodecCaps
impl CodecCaps
Sourcepub const fn round_trip() -> Self
pub const fn round_trip() -> Self
A codec that both compresses and decompresses, with no parallelism and no frame index. The common shape.
Sourcepub const fn decode_only() -> Self
pub const fn decode_only() -> Self
A decode-only codec — the pure-Rust fallbacks that let a build with no C
toolchain still open a .zst or .xz.