Function zstd_sys::ZSTD_CCtx_loadDictionary
source · pub unsafe extern "C" fn ZSTD_CCtx_loadDictionary(
cctx: *mut ZSTD_CCtx,
dict: *const c_void,
dictSize: usize
) -> usize
Expand description
ZSTD_CCtx_loadDictionary() : Requires v1.4.0+
Create an internal CDict from dict
buffer.
Decompression will have to use same dictionary.
@result : 0, or an error code (which can be tested with ZSTD_isError()).
Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary,
meaning “return to no-dictionary mode”.
Note 1 : Dictionary is sticky, it will be used for all future compressed frames,
until parameters are reset, a new dictionary is loaded, or the dictionary
is explicitly invalidated by loading a NULL dictionary.
Note 2 : Loading a dictionary involves building tables.
It’s also a CPU consuming operation, with non-negligible impact on latency.
Tables are dependent on compression parameters, and for this reason,
compression parameters can no longer be changed after loading a dictionary.
Note 3 :dict
content will be copied internally.
Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead.
In such a case, dictionary buffer must outlive its users.
Note 4 : Use ZSTD_CCtx_loadDictionary_advanced()
to precisely select how dictionary content must be interpreted.