[][src]Function zstd_safe::dctx_ref_prefix

pub fn dctx_ref_prefix<'a>(
    dctx: &mut DCtx<'a>,
    prefix: &'a [u8]
) -> Result<usize, usize>

ZSTD_DCtx_refPrefix()

Reference a prefix (single-usage dictionary) to decompress next frame.

This is the reverse operation of ZSTD_CCtx_refPrefix(), and must use the same prefix as the one used during compression.

Prefix is only used once. Reference is discarded at end of frame.

End of frame is reached when ZSTD_decompressStream() returns 0.

result : 0, or an error code (which can be tested with ZSTD_isError()).

Note 1 : Adding any prefix (including NULL) invalidates any previously set prefix or dictionary

Note 2 : Prefix buffer is referenced. It must outlive decompression. Prefix buffer must remain unmodified up to the end of frame, reached when ZSTD_decompressStream() returns 0.

Note 3 : By default, the prefix is treated as raw content (ZSTD_dm_rawContent). Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section)

Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost. A full dictionary is more costly, as it requires building tables.