Skip to main content

Module zstd_leaf

Module zstd_leaf 

Source
Expand description

Zstd leaf (encoding id 11), the optional general-purpose stage for cold string segments where ratio matters more than decode speed. Everything else in the cascade is a lightweight encoding; this is the one deliberate exception, and it is a leaf: nothing cascades below it.

The zstd feature links libzstd for compression and fast decode. Builds without it stay pure Rust and still read every file through ruzstd, so the default build can open a database written by a feature-full one; only encode needs the feature. decode_fallback is the ruzstd path under its own name so tests and fuzzing can pin it even when libzstd is linked.

Layout: raw_len: u32 LE, then one zstd frame.

Functionsยง

decode
Decodes an encoded buffer, appending at most max_len bytes to out. With the zstd feature this is libzstd; without it, ruzstd. A rejected payload leaves out untouched.
decode_fallback
The pure Rust read path, always available regardless of features.