226 lines
37 KiB
HTML
226 lines
37 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Low-level bindings to the zstd library."><title>zstd_sys - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="zstd_sys" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate zstd_sys</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../zstd_sys/index.html">zstd_<wbr>sys</a><span class="version">2.0.16+zstd.1.5.7</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>zstd_<wbr>sys</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/zstd_sys/lib.rs.html#1-41">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Low-level bindings to the <a href="https://facebook.github.io/zstd/">zstd</a> library.</p>
|
||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.ZSTD_CCtx_s.html" title="struct zstd_sys::ZSTD_CCtx_s">ZSTD_<wbr>CCtx_<wbr>s</a></dt><dt><a class="struct" href="struct.ZSTD_CDict_s.html" title="struct zstd_sys::ZSTD_CDict_s">ZSTD_<wbr>CDict_<wbr>s</a></dt><dt><a class="struct" href="struct.ZSTD_DCtx_s.html" title="struct zstd_sys::ZSTD_DCtx_s">ZSTD_<wbr>DCtx_<wbr>s</a></dt><dt><a class="struct" href="struct.ZSTD_DDict_s.html" title="struct zstd_sys::ZSTD_DDict_s">ZSTD_<wbr>DDict_<wbr>s</a></dt><dt><a class="struct" href="struct.ZSTD_bounds.html" title="struct zstd_sys::ZSTD_bounds">ZSTD_<wbr>bounds</a></dt><dt><a class="struct" href="struct.ZSTD_inBuffer_s.html" title="struct zstd_sys::ZSTD_inBuffer_s">ZSTD_<wbr>inBuffer_<wbr>s</a></dt><dd>Streaming</dd><dt><a class="struct" href="struct.ZSTD_outBuffer_s.html" title="struct zstd_sys::ZSTD_outBuffer_s">ZSTD_<wbr>outBuffer_<wbr>s</a></dt></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.ZSTD_EndDirective.html" title="enum zstd_sys::ZSTD_EndDirective">ZSTD_<wbr>EndDirective</a></dt><dt><a class="enum" href="enum.ZSTD_ErrorCode.html" title="enum zstd_sys::ZSTD_ErrorCode">ZSTD_<wbr>Error<wbr>Code</a></dt><dt><a class="enum" href="enum.ZSTD_ResetDirective.html" title="enum zstd_sys::ZSTD_ResetDirective">ZSTD_<wbr>Reset<wbr>Directive</a></dt><dt><a class="enum" href="enum.ZSTD_cParameter.html" title="enum zstd_sys::ZSTD_cParameter">ZSTD_<wbr>cParameter</a></dt><dt><a class="enum" href="enum.ZSTD_dParameter.html" title="enum zstd_sys::ZSTD_dParameter">ZSTD_<wbr>dParameter</a></dt><dd>Advanced decompression API (Requires v1.4.0+)</dd><dt><a class="enum" href="enum.ZSTD_strategy.html" title="enum zstd_sys::ZSTD_strategy">ZSTD_<wbr>strategy</a></dt><dd>Advanced compression API (Requires v1.4.0+)</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.ZSTD_BLOCKSIZELOG_MAX.html" title="constant zstd_sys::ZSTD_BLOCKSIZELOG_MAX">ZSTD_<wbr>BLOCKSIZELOG_<wbr>MAX</a></dt><dt><a class="constant" href="constant.ZSTD_BLOCKSIZE_MAX.html" title="constant zstd_sys::ZSTD_BLOCKSIZE_MAX">ZSTD_<wbr>BLOCKSIZE_<wbr>MAX</a></dt><dt><a class="constant" href="constant.ZSTD_CLEVEL_DEFAULT.html" title="constant zstd_sys::ZSTD_CLEVEL_DEFAULT">ZSTD_<wbr>CLEVEL_<wbr>DEFAULT</a></dt><dt><a class="constant" href="constant.ZSTD_CONTENTSIZE_ERROR.html" title="constant zstd_sys::ZSTD_CONTENTSIZE_ERROR">ZSTD_<wbr>CONTENTSIZE_<wbr>ERROR</a></dt><dt><a class="constant" href="constant.ZSTD_CONTENTSIZE_UNKNOWN.html" title="constant zstd_sys::ZSTD_CONTENTSIZE_UNKNOWN">ZSTD_<wbr>CONTENTSIZE_<wbr>UNKNOWN</a></dt><dt><a class="constant" href="constant.ZSTD_MAGICNUMBER.html" title="constant zstd_sys::ZSTD_MAGICNUMBER">ZSTD_<wbr>MAGICNUMBER</a></dt><dt><a class="constant" href="constant.ZSTD_MAGIC_DICTIONARY.html" title="constant zstd_sys::ZSTD_MAGIC_DICTIONARY">ZSTD_<wbr>MAGIC_<wbr>DICTIONARY</a></dt><dt><a class="constant" href="constant.ZSTD_MAGIC_SKIPPABLE_MASK.html" title="constant zstd_sys::ZSTD_MAGIC_SKIPPABLE_MASK">ZSTD_<wbr>MAGIC_<wbr>SKIPPABLE_<wbr>MASK</a></dt><dt><a class="constant" href="constant.ZSTD_MAGIC_SKIPPABLE_START.html" title="constant zstd_sys::ZSTD_MAGIC_SKIPPABLE_START">ZSTD_<wbr>MAGIC_<wbr>SKIPPABLE_<wbr>START</a></dt><dt><a class="constant" href="constant.ZSTD_VERSION_MAJOR.html" title="constant zstd_sys::ZSTD_VERSION_MAJOR">ZSTD_<wbr>VERSION_<wbr>MAJOR</a></dt><dt><a class="constant" href="constant.ZSTD_VERSION_MINOR.html" title="constant zstd_sys::ZSTD_VERSION_MINOR">ZSTD_<wbr>VERSION_<wbr>MINOR</a></dt><dt><a class="constant" href="constant.ZSTD_VERSION_NUMBER.html" title="constant zstd_sys::ZSTD_VERSION_NUMBER">ZSTD_<wbr>VERSION_<wbr>NUMBER</a></dt><dt><a class="constant" href="constant.ZSTD_VERSION_RELEASE.html" title="constant zstd_sys::ZSTD_VERSION_RELEASE">ZSTD_<wbr>VERSION_<wbr>RELEASE</a></dt></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.ZSTD_CCtx_loadDictionary.html" title="fn zstd_sys::ZSTD_CCtx_loadDictionary">ZSTD_<wbr>CCtx_<wbr>load<wbr>Dictionary</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_CCtx_loadDictionary() : Requires v1.4.0+
|
||
Create an internal CDict from <code>dict</code> 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 :<code>dict</code> 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.
|
||
Note 5 : This method does not benefit from LDM (long distance mode).
|
||
If you want to employ LDM on some large dictionary content,
|
||
prefer employing ZSTD_CCtx_refPrefix() described below.</dd><dt><a class="fn" href="fn.ZSTD_CCtx_refCDict.html" title="fn zstd_sys::ZSTD_CCtx_refCDict">ZSTD_<wbr>CCtx_<wbr>refC<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_CCtx_refCDict() : Requires v1.4.0+
|
||
Reference a prepared dictionary, to be used for all future compressed frames.
|
||
Note that compression parameters are enforced from within CDict,
|
||
and supersede any compression parameter previously set within CCtx.
|
||
The parameters ignored are labelled as “superseded-by-cdict” in the ZSTD_cParameter enum docs.
|
||
The ignored parameters will be used again if the CCtx is returned to no-dictionary mode.
|
||
The dictionary will remain valid for future compressed frames using same CCtx.
|
||
@result : 0, or an error code (which can be tested with ZSTD_isError()).
|
||
Special : Referencing a NULL CDict means “return to no-dictionary mode”.
|
||
Note 1 : Currently, only one dictionary can be managed.
|
||
Referencing a new dictionary effectively “discards” any previous one.
|
||
Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx.</dd><dt><a class="fn" href="fn.ZSTD_CCtx_refPrefix.html" title="fn zstd_sys::ZSTD_CCtx_refPrefix">ZSTD_<wbr>CCtx_<wbr>refPrefix</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_CCtx_refPrefix() : Requires v1.4.0+
|
||
Reference a prefix (single-usage dictionary) for next compressed frame.
|
||
A prefix is <strong>only used once</strong>. Tables are discarded at end of frame (ZSTD_e_end).
|
||
Decompression will need same prefix to properly regenerate data.
|
||
Compressing with a prefix is similar in outcome as performing a diff and compressing it,
|
||
but performs much faster, especially during decompression (compression speed is tunable with compression level).
|
||
This method is compatible with LDM (long distance mode).
|
||
@result : 0, or an error code (which can be tested with ZSTD_isError()).
|
||
Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary
|
||
Note 1 : Prefix buffer is referenced. It <strong>must</strong> outlive compression.
|
||
Its content must remain unmodified during compression.
|
||
Note 2 : If the intention is to diff some large src data blob with some prior version of itself,
|
||
ensure that the window size is large enough to contain the entire source.
|
||
See ZSTD_c_windowLog.
|
||
Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
|
||
It’s a CPU consuming operation, with non-negligible impact on latency.
|
||
If there is a need to use the same prefix multiple times, consider loadDictionary instead.
|
||
Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent).
|
||
Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation.</dd><dt><a class="fn" href="fn.ZSTD_CCtx_reset.html" title="fn zstd_sys::ZSTD_CCtx_reset">ZSTD_<wbr>CCtx_<wbr>reset</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_CCtx_reset() :
|
||
There are 2 different things that can be reset, independently or jointly :</dd><dt><a class="fn" href="fn.ZSTD_CCtx_setParameter.html" title="fn zstd_sys::ZSTD_CCtx_setParameter">ZSTD_<wbr>CCtx_<wbr>setParameter</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_CCtx_setParameter() :
|
||
Set one compression parameter, selected by enum ZSTD_cParameter.
|
||
All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds().
|
||
Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter).
|
||
Setting a parameter is generally only possible during frame initialization (before starting compression).
|
||
Exception : when using multi-threading mode (nbWorkers >= 1),
|
||
the following parameters can be updated <em>during</em> compression (within same frame):
|
||
=> compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy.
|
||
new parameters will be active for next job only (after a flush()).
|
||
@return : an error code (which can be tested using ZSTD_isError()).</dd><dt><a class="fn" href="fn.ZSTD_CCtx_setPledgedSrcSize.html" title="fn zstd_sys::ZSTD_CCtx_setPledgedSrcSize">ZSTD_<wbr>CCtx_<wbr>setPledged<wbr>SrcSize</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_CCtx_setPledgedSrcSize() :
|
||
Total input data size to be compressed as a single frame.
|
||
Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag.
|
||
This value will also be controlled at end of frame, and trigger an error if not respected.
|
||
@result : 0, or an error code (which can be tested with ZSTD_isError()).
|
||
Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame.
|
||
In order to mean “unknown content size”, pass constant ZSTD_CONTENTSIZE_UNKNOWN.
|
||
ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame.
|
||
Note 2 : pledgedSrcSize is only valid once, for the next frame.
|
||
It’s discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN.
|
||
Note 3 : Whenever all input data is provided and consumed in a single round,
|
||
for example with ZSTD_compress2(),
|
||
or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end),
|
||
this value is automatically overridden by srcSize instead.</dd><dt><a class="fn" href="fn.ZSTD_CStreamInSize.html" title="fn zstd_sys::ZSTD_CStreamInSize">ZSTD_<wbr>CStream<wbr>InSize</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_CStreamOutSize.html" title="fn zstd_sys::ZSTD_CStreamOutSize">ZSTD_<wbr>CStream<wbr>OutSize</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_DCtx_loadDictionary.html" title="fn zstd_sys::ZSTD_DCtx_loadDictionary">ZSTD_<wbr>DCtx_<wbr>load<wbr>Dictionary</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_DCtx_loadDictionary() : Requires v1.4.0+
|
||
Create an internal DDict from dict buffer, to be used to decompress all future frames.
|
||
The dictionary remains valid for all future frames, until explicitly invalidated, or
|
||
a new dictionary is loaded.
|
||
@result : 0, or an error code (which can be tested with ZSTD_isError()).
|
||
Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,
|
||
meaning “return to no-dictionary mode”.
|
||
Note 1 : Loading a dictionary involves building tables,
|
||
which has a non-negligible impact on CPU usage and latency.
|
||
It’s recommended to “load once, use many times”, to amortize the cost
|
||
Note 2 :<code>dict</code> content will be copied internally, so <code>dict</code> can be released after loading.
|
||
Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead.
|
||
Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of
|
||
how dictionary content is loaded and interpreted.</dd><dt><a class="fn" href="fn.ZSTD_DCtx_refDDict.html" title="fn zstd_sys::ZSTD_DCtx_refDDict">ZSTD_<wbr>DCtx_<wbr>refD<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_DCtx_refDDict() : Requires v1.4.0+
|
||
Reference a prepared dictionary, to be used to decompress next frames.
|
||
The dictionary remains active for decompression of future frames using same DCtx.</dd><dt><a class="fn" href="fn.ZSTD_DCtx_refPrefix.html" title="fn zstd_sys::ZSTD_DCtx_refPrefix">ZSTD_<wbr>DCtx_<wbr>refPrefix</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_DCtx_refPrefix() : Requires v1.4.0+
|
||
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 <strong>only used once</strong>. 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 <strong>must</strong> 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_dct_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.</dd><dt><a class="fn" href="fn.ZSTD_DCtx_reset.html" title="fn zstd_sys::ZSTD_DCtx_reset">ZSTD_<wbr>DCtx_<wbr>reset</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_DCtx_reset() :
|
||
Return a DCtx to clean state.
|
||
Session and parameters can be reset jointly or separately.
|
||
Parameters can only be reset when no active frame is being decompressed.
|
||
@return : 0, or an error code, which can be tested with ZSTD_isError()</dd><dt><a class="fn" href="fn.ZSTD_DCtx_setParameter.html" title="fn zstd_sys::ZSTD_DCtx_setParameter">ZSTD_<wbr>DCtx_<wbr>setParameter</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_DCtx_setParameter() :
|
||
Set one compression parameter, selected by enum ZSTD_dParameter.
|
||
All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds().
|
||
Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter).
|
||
Setting a parameter is only possible during frame initialization (before starting decompression).
|
||
@return : 0, or an error code (which can be tested using ZSTD_isError()).</dd><dt><a class="fn" href="fn.ZSTD_DStreamInSize.html" title="fn zstd_sys::ZSTD_DStreamInSize">ZSTD_<wbr>DStream<wbr>InSize</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_DStreamOutSize.html" title="fn zstd_sys::ZSTD_DStreamOutSize">ZSTD_<wbr>DStream<wbr>OutSize</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_cParam_getBounds.html" title="fn zstd_sys::ZSTD_cParam_getBounds">ZSTD_<wbr>cParam_<wbr>getBounds</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_cParam_getBounds() :
|
||
All parameters must belong to an interval with lower and upper bounds,
|
||
otherwise they will either trigger an error or be automatically clamped.
|
||
@return : a structure, ZSTD_bounds, which contains
|
||
- an error status field, which must be tested using ZSTD_isError()
|
||
- lower and upper bounds, both inclusive</dd><dt><a class="fn" href="fn.ZSTD_compress.html" title="fn zstd_sys::ZSTD_compress">ZSTD_<wbr>compress</a><sup title="unsafe function">⚠</sup></dt><dd>Simple Core API
|
||
/
|
||
/*! ZSTD_compress() :
|
||
Compresses <code>src</code> content as a single zstd compressed frame into already allocated <code>dst</code>.
|
||
NOTE: Providing <code>dstCapacity >= ZSTD_compressBound(srcSize)</code> guarantees that zstd will have
|
||
enough space to successfully compress the data.
|
||
@return : compressed size written into <code>dst</code> (<= `dstCapacity),
|
||
or an error code if it fails (which can be tested using ZSTD_isError()).</dd><dt><a class="fn" href="fn.ZSTD_compress2.html" title="fn zstd_sys::ZSTD_compress2">ZSTD_<wbr>compress2</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_compress2() :
|
||
Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API.
|
||
(note that this entry point doesn’t even expose a compression level parameter).
|
||
ZSTD_compress2() always starts a new frame.
|
||
Should cctx hold data from a previously unfinished frame, everything about it is forgotten.</dd><dt><a class="fn" href="fn.ZSTD_compressBound.html" title="fn zstd_sys::ZSTD_compressBound">ZSTD_<wbr>compress<wbr>Bound</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_compressCCtx.html" title="fn zstd_sys::ZSTD_compressCCtx">ZSTD_<wbr>compressC<wbr>Ctx</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_compressCCtx() :
|
||
Same as ZSTD_compress(), using an explicit ZSTD_CCtx.
|
||
Important : in order to mirror <code>ZSTD_compress()</code> behavior,
|
||
this function compresses at the requested compression level,
|
||
<strong>ignoring any other advanced parameter</strong> .
|
||
If any advanced parameter was set using the advanced API,
|
||
they will all be reset. Only @compressionLevel remains.</dd><dt><a class="fn" href="fn.ZSTD_compressStream.html" title="fn zstd_sys::ZSTD_compressStream">ZSTD_<wbr>compress<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dd>Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue).
|
||
NOTE: The return value is different. ZSTD_compressStream() returns a hint for
|
||
the next read size (if non-zero and not an error). ZSTD_compressStream2()
|
||
returns the minimum nb of bytes left to flush (if non-zero and not an error).</dd><dt><a class="fn" href="fn.ZSTD_compressStream2.html" title="fn zstd_sys::ZSTD_compressStream2">ZSTD_<wbr>compress<wbr>Stream2</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_compressStream2() : Requires v1.4.0+
|
||
Behaves about the same as ZSTD_compressStream, with additional control on end directive.</dd><dt><a class="fn" href="fn.ZSTD_compress_usingCDict.html" title="fn zstd_sys::ZSTD_compress_usingCDict">ZSTD_<wbr>compress_<wbr>usingC<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_compress_usingCDict() :
|
||
Compression using a digested Dictionary.
|
||
Recommended when same dictionary is used multiple times.
|
||
Note : compression level is <em>decided at dictionary creation time</em>,
|
||
and frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)</dd><dt><a class="fn" href="fn.ZSTD_compress_usingDict.html" title="fn zstd_sys::ZSTD_compress_usingDict">ZSTD_<wbr>compress_<wbr>using<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>Simple dictionary API
|
||
/
|
||
/*! ZSTD_compress_usingDict() :
|
||
Compression at an explicit compression level using a Dictionary.
|
||
A dictionary can be any arbitrary data segment (also called a prefix),
|
||
or a buffer with specified information (see zdict.h).
|
||
Note : This function loads the dictionary, resulting in significant startup delay.
|
||
It’s intended for a dictionary used only once.
|
||
Note 2 : When <code>dict == NULL || dictSize < 8</code> no dictionary is used.</dd><dt><a class="fn" href="fn.ZSTD_createCCtx.html" title="fn zstd_sys::ZSTD_createCCtx">ZSTD_<wbr>createC<wbr>Ctx</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_createCDict.html" title="fn zstd_sys::ZSTD_createCDict">ZSTD_<wbr>createC<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_createCDict() :
|
||
When compressing multiple messages or blocks using the same dictionary,
|
||
it’s recommended to digest the dictionary only once, since it’s a costly operation.
|
||
ZSTD_createCDict() will create a state from digesting a dictionary.
|
||
The resulting state can be used for future compression operations with very limited startup cost.
|
||
ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only.
|
||
@dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict.
|
||
Note 1 : Consider experimental function <code>ZSTD_createCDict_byReference()</code> if you prefer to not duplicate @dictBuffer content.
|
||
Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer,
|
||
in which case the only thing that it transports is the @compressionLevel.
|
||
This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively,
|
||
expecting a ZSTD_CDict parameter with any data, including those without a known dictionary.</dd><dt><a class="fn" href="fn.ZSTD_createCStream.html" title="fn zstd_sys::ZSTD_createCStream">ZSTD_<wbr>createC<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_createDCtx.html" title="fn zstd_sys::ZSTD_createDCtx">ZSTD_<wbr>createD<wbr>Ctx</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_createDDict.html" title="fn zstd_sys::ZSTD_createDDict">ZSTD_<wbr>createD<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_createDDict() :
|
||
Create a digested dictionary, ready to start decompression operation without startup delay.
|
||
dictBuffer can be released after DDict creation, as its content is copied inside DDict.</dd><dt><a class="fn" href="fn.ZSTD_createDStream.html" title="fn zstd_sys::ZSTD_createDStream">ZSTD_<wbr>createD<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_dParam_getBounds.html" title="fn zstd_sys::ZSTD_dParam_getBounds">ZSTD_<wbr>dParam_<wbr>getBounds</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_dParam_getBounds() :
|
||
All parameters must belong to an interval with lower and upper bounds,
|
||
otherwise they will either trigger an error or be automatically clamped.
|
||
@return : a structure, ZSTD_bounds, which contains
|
||
- an error status field, which must be tested using ZSTD_isError()
|
||
- both lower and upper bounds, inclusive</dd><dt><a class="fn" href="fn.ZSTD_decompress.html" title="fn zstd_sys::ZSTD_decompress">ZSTD_<wbr>decompress</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_decompress() :
|
||
<code>compressedSize</code> : must be the <em>exact</em> size of some number of compressed and/or skippable frames.
|
||
Multiple compressed frames can be decompressed at once with this method.
|
||
The result will be the concatenation of all decompressed frames, back to back.
|
||
<code>dstCapacity</code> is an upper bound of originalSize to regenerate.
|
||
First frame’s decompressed size can be extracted using ZSTD_getFrameContentSize().
|
||
If maximum upper bound isn’t known, prefer using streaming mode to decompress data.
|
||
@return : the number of bytes decompressed into <code>dst</code> (<= <code>dstCapacity</code>),
|
||
or an errorCode if it fails (which can be tested using ZSTD_isError()).</dd><dt><a class="fn" href="fn.ZSTD_decompressDCtx.html" title="fn zstd_sys::ZSTD_decompressDCtx">ZSTD_<wbr>decompressD<wbr>Ctx</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_decompressDCtx() :
|
||
Same as ZSTD_decompress(),
|
||
requires an allocated ZSTD_DCtx.
|
||
Compatible with sticky parameters (see below).</dd><dt><a class="fn" href="fn.ZSTD_decompressStream.html" title="fn zstd_sys::ZSTD_decompressStream">ZSTD_<wbr>decompress<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_decompressStream() :
|
||
Streaming decompression function.
|
||
Call repetitively to consume full input updating it as necessary.
|
||
Function will update both input and output <code>pos</code> fields exposing current state via these fields:</dd><dt><a class="fn" href="fn.ZSTD_decompress_usingDDict.html" title="fn zstd_sys::ZSTD_decompress_usingDDict">ZSTD_<wbr>decompress_<wbr>usingD<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_decompress_usingDDict() :
|
||
Decompression using a digested Dictionary.
|
||
Recommended when same dictionary is used multiple times.</dd><dt><a class="fn" href="fn.ZSTD_decompress_usingDict.html" title="fn zstd_sys::ZSTD_decompress_usingDict">ZSTD_<wbr>decompress_<wbr>using<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_decompress_usingDict() :
|
||
Decompression using a known Dictionary.
|
||
Dictionary must be identical to the one used during compression.
|
||
Note : This function loads the dictionary, resulting in significant startup delay.
|
||
It’s intended for a dictionary used only once.
|
||
Note : When <code>dict == NULL || dictSize < 8</code> no dictionary is used.</dd><dt><a class="fn" href="fn.ZSTD_defaultCLevel.html" title="fn zstd_sys::ZSTD_defaultCLevel">ZSTD_<wbr>defaultC<wbr>Level</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_endStream.html" title="fn zstd_sys::ZSTD_endStream">ZSTD_<wbr>endStream</a><sup title="unsafe function">⚠</sup></dt><dd>Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end).</dd><dt><a class="fn" href="fn.ZSTD_findFrameCompressedSize.html" title="fn zstd_sys::ZSTD_findFrameCompressedSize">ZSTD_<wbr>find<wbr>Frame<wbr>Compressed<wbr>Size</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_findFrameCompressedSize() : Requires v1.4.0+
|
||
<code>src</code> should point to the start of a ZSTD frame or skippable frame.
|
||
<code>srcSize</code> must be >= first frame size
|
||
@return : the compressed size of the first frame starting at <code>src</code>,
|
||
suitable to pass as <code>srcSize</code> to <code>ZSTD_decompress</code> or similar,
|
||
or an error code if input is invalid
|
||
Note 1: this method is called _find*() because it’s not enough to read the header,
|
||
it may have to scan through the frame’s content, to reach its end.
|
||
Note 2: this method also works with Skippable Frames. In which case,
|
||
it returns the size of the complete skippable frame,
|
||
which is always equal to its content size + 8 bytes for headers.</dd><dt><a class="fn" href="fn.ZSTD_flushStream.html" title="fn zstd_sys::ZSTD_flushStream">ZSTD_<wbr>flush<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dd>Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush).</dd><dt><a class="fn" href="fn.ZSTD_freeCCtx.html" title="fn zstd_sys::ZSTD_freeCCtx">ZSTD_<wbr>freeC<wbr>Ctx</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_freeCDict.html" title="fn zstd_sys::ZSTD_freeCDict">ZSTD_<wbr>freeC<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_freeCDict() :
|
||
Function frees memory allocated by ZSTD_createCDict().
|
||
If a NULL pointer is passed, no operation is performed.</dd><dt><a class="fn" href="fn.ZSTD_freeCStream.html" title="fn zstd_sys::ZSTD_freeCStream">ZSTD_<wbr>freeC<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_freeDCtx.html" title="fn zstd_sys::ZSTD_freeDCtx">ZSTD_<wbr>freeD<wbr>Ctx</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_freeDDict.html" title="fn zstd_sys::ZSTD_freeDDict">ZSTD_<wbr>freeD<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_freeDDict() :
|
||
Function frees memory allocated with ZSTD_createDDict()
|
||
If a NULL pointer is passed, no operation is performed.</dd><dt><a class="fn" href="fn.ZSTD_freeDStream.html" title="fn zstd_sys::ZSTD_freeDStream">ZSTD_<wbr>freeD<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_getDecompressedSize.html" title="fn zstd_sys::ZSTD_getDecompressedSize">ZSTD_<wbr>getDecompressed<wbr>Size</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_getDecompressedSize() (obsolete):
|
||
This function is now obsolete, in favor of ZSTD_getFrameContentSize().
|
||
Both functions work the same way, but ZSTD_getDecompressedSize() blends
|
||
“empty”, “unknown” and “error” results to the same return value (0),
|
||
while ZSTD_getFrameContentSize() gives them separate return values.
|
||
@return : decompressed size of <code>src</code> frame content <em>if known and not empty</em>, 0 otherwise.</dd><dt><a class="fn" href="fn.ZSTD_getDictID_fromCDict.html" title="fn zstd_sys::ZSTD_getDictID_fromCDict">ZSTD_<wbr>getDictID_<wbr>fromC<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_getDictID_fromCDict() : Requires v1.5.0+
|
||
Provides the dictID of the dictionary loaded into <code>cdict</code>.
|
||
If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
|
||
Non-conformant dictionaries can still be loaded, but as content-only dictionaries.</dd><dt><a class="fn" href="fn.ZSTD_getDictID_fromDDict.html" title="fn zstd_sys::ZSTD_getDictID_fromDDict">ZSTD_<wbr>getDictID_<wbr>fromD<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_getDictID_fromDDict() : Requires v1.4.0+
|
||
Provides the dictID of the dictionary loaded into <code>ddict</code>.
|
||
If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
|
||
Non-conformant dictionaries can still be loaded, but as content-only dictionaries.</dd><dt><a class="fn" href="fn.ZSTD_getDictID_fromDict.html" title="fn zstd_sys::ZSTD_getDictID_fromDict">ZSTD_<wbr>getDictID_<wbr>from<wbr>Dict</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_getDictID_fromDict() : Requires v1.4.0+
|
||
Provides the dictID stored within dictionary.
|
||
if @return == 0, the dictionary is not conformant with Zstandard specification.
|
||
It can still be loaded, but as a content-only dictionary.</dd><dt><a class="fn" href="fn.ZSTD_getDictID_fromFrame.html" title="fn zstd_sys::ZSTD_getDictID_fromFrame">ZSTD_<wbr>getDictID_<wbr>from<wbr>Frame</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_getDictID_fromFrame() : Requires v1.4.0+
|
||
Provides the dictID required to decompressed the frame stored within <code>src</code>.
|
||
If @return == 0, the dictID could not be decoded.
|
||
This could for one of the following reasons :</dd><dt><a class="fn" href="fn.ZSTD_getErrorCode.html" title="fn zstd_sys::ZSTD_getErrorCode">ZSTD_<wbr>getError<wbr>Code</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_getErrorName.html" title="fn zstd_sys::ZSTD_getErrorName">ZSTD_<wbr>getError<wbr>Name</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_getErrorString.html" title="fn zstd_sys::ZSTD_getErrorString">ZSTD_<wbr>getError<wbr>String</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_getFrameContentSize.html" title="fn zstd_sys::ZSTD_getFrameContentSize">ZSTD_<wbr>getFrame<wbr>Content<wbr>Size</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_initCStream.html" title="fn zstd_sys::ZSTD_initCStream">ZSTD_<wbr>initC<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dd>Equivalent to:</dd><dt><a class="fn" href="fn.ZSTD_initDStream.html" title="fn zstd_sys::ZSTD_initDStream">ZSTD_<wbr>initD<wbr>Stream</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_initDStream() :
|
||
Initialize/reset DStream state for new decompression operation.
|
||
Call before new decompression operation using same DStream.</dd><dt><a class="fn" href="fn.ZSTD_isError.html" title="fn zstd_sys::ZSTD_isError">ZSTD_<wbr>isError</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_maxCLevel.html" title="fn zstd_sys::ZSTD_maxCLevel">ZSTD_<wbr>maxC<wbr>Level</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_minCLevel.html" title="fn zstd_sys::ZSTD_minCLevel">ZSTD_<wbr>minC<wbr>Level</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_sizeof_CCtx.html" title="fn zstd_sys::ZSTD_sizeof_CCtx">ZSTD_<wbr>sizeof_<wbr>CCtx</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_sizeof_*() : Requires v1.4.0+
|
||
These functions give the <em>current</em> memory usage of selected object.
|
||
Note that object memory usage can evolve (increase or decrease) over time.</dd><dt><a class="fn" href="fn.ZSTD_sizeof_CDict.html" title="fn zstd_sys::ZSTD_sizeof_CDict">ZSTD_<wbr>sizeof_<wbr>CDict</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_sizeof_CStream.html" title="fn zstd_sys::ZSTD_sizeof_CStream">ZSTD_<wbr>sizeof_<wbr>CStream</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_sizeof_DCtx.html" title="fn zstd_sys::ZSTD_sizeof_DCtx">ZSTD_<wbr>sizeof_<wbr>DCtx</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_sizeof_DDict.html" title="fn zstd_sys::ZSTD_sizeof_DDict">ZSTD_<wbr>sizeof_<wbr>DDict</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_sizeof_DStream.html" title="fn zstd_sys::ZSTD_sizeof_DStream">ZSTD_<wbr>sizeof_<wbr>DStream</a><sup title="unsafe function">⚠</sup></dt><dt><a class="fn" href="fn.ZSTD_versionNumber.html" title="fn zstd_sys::ZSTD_versionNumber">ZSTD_<wbr>version<wbr>Number</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_versionNumber() :
|
||
Return runtime library version, the value is (MAJOR<em>100</em>100 + MINOR*100 + RELEASE).</dd><dt><a class="fn" href="fn.ZSTD_versionString.html" title="fn zstd_sys::ZSTD_versionString">ZSTD_<wbr>version<wbr>String</a><sup title="unsafe function">⚠</sup></dt><dd>ZSTD_versionString() :
|
||
Return runtime library version, like “1.4.5”. Requires v1.3.0+.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.ZSTD_CCtx.html" title="type zstd_sys::ZSTD_CCtx">ZSTD_<wbr>CCtx</a></dt><dd>Explicit context</dd><dt><a class="type" href="type.ZSTD_CDict.html" title="type zstd_sys::ZSTD_CDict">ZSTD_<wbr>CDict</a></dt><dd>Bulk processing dictionary API</dd><dt><a class="type" href="type.ZSTD_CStream.html" title="type zstd_sys::ZSTD_CStream">ZSTD_<wbr>CStream</a></dt><dt><a class="type" href="type.ZSTD_DCtx.html" title="type zstd_sys::ZSTD_DCtx">ZSTD_<wbr>DCtx</a></dt><dt><a class="type" href="type.ZSTD_DDict.html" title="type zstd_sys::ZSTD_DDict">ZSTD_<wbr>DDict</a></dt><dt><a class="type" href="type.ZSTD_DStream.html" title="type zstd_sys::ZSTD_DStream">ZSTD_<wbr>DStream</a></dt><dt><a class="type" href="type.ZSTD_inBuffer.html" title="type zstd_sys::ZSTD_inBuffer">ZSTD_<wbr>inBuffer</a></dt><dd>Streaming</dd><dt><a class="type" href="type.ZSTD_outBuffer.html" title="type zstd_sys::ZSTD_outBuffer">ZSTD_<wbr>outBuffer</a></dt></dl></section></div></main></body></html> |