|
| 1 | +//! zstd, short for *Zstandard*, is a fast lossless compression algorithm, targeting real-time |
| 2 | +//! compression scenarios at zlib-level and better compression ratios. The zstd compression library |
| 3 | +//! provides in-memory compression and decompression functions. |
| 4 | +//! |
| 5 | +//! The library supports regular compression levels from 1 up to [`ZSTD_maxCLevel`], which is |
| 6 | +//! currently 22. Levels >= 20, labeled `--ultra`, should be used with caution, as they require |
| 7 | +//! more memory. The library also offers negative compression levels, which extend the range of |
| 8 | +//! speed vs. ratio preferences. The lower the level, the faster the speed (at the cost of |
| 9 | +//! compression). |
| 10 | +//! |
| 11 | +//! (De-)compression can be done in: |
| 12 | +//! - a single step (described as *Simple API*) using [`ZSTD_compress`] and [`ZSTD_decompress`] |
| 13 | +//! - a single step, reusing a context (described as *Explicit context*) using |
| 14 | +//! [`ZSTD_createCCtx`] and [`ZSTD_createDCtx`] to create the context, and using |
| 15 | +//! [`ZSTD_compressCCtx`] and [`ZSTD_decompressDCtx`] to (de-)compress |
| 16 | +//! - unbounded multiple steps (described as *Streaming compression*), using |
| 17 | +//! [`ZSTD_createCStream`] and [`ZSTD_createDStream`] to create a stream, [`ZSTD_initCStream`] |
| 18 | +//! and [`ZSTD_initDStream`] to (re-)initialize the stream for (de)-compression, and |
| 19 | +//! [`ZSTD_compressStream2`] and [`ZSTD_decompressStream`] to consume input |
| 20 | +//! |
| 21 | +//! The compression ratio achievable on small data can be highly improved using a dictionary. |
| 22 | +//! Dictionary compression can be performed in: |
| 23 | +//! - a single step (described as *Simple dictionary API*), using [`ZSTD_compress_usingDict`] and |
| 24 | +//! [`ZSTD_decompress_usingDict`] |
| 25 | +//! - a single step, reusing a dictionary (described as *Bulk-processing dictionary API*), using |
| 26 | +//! [`ZSTD_createCDict`] and [`ZSTD_createDDict`] to create a dictionary, and using |
| 27 | +//! [`ZSTD_compress_usingCDict`] and [`ZSTD_decompress_usingDDict`] to (de-)compress using the |
| 28 | +//! dictionary |
| 29 | +//! |
| 30 | +//! Advanced experimental APIs should never be used with a dynamically-linked library. They are not |
| 31 | +//! "stable"; their definitions or signatures may change in the future. Only static linking is |
| 32 | +//! allowed. |
| 33 | +
|
1 | 34 | #![allow(non_camel_case_types)] |
2 | 35 | #![allow(non_snake_case)] |
3 | 36 | #![allow(non_upper_case_globals)] |
@@ -78,8 +111,8 @@ pub use crate::lib::zstd::{ |
78 | 111 |
|
79 | 112 | pub use crate::lib::decompress::{ |
80 | 113 | zstd_ddict::{ |
81 | | - ZSTD_DDict, ZSTD_createDDict, ZSTD_createDDict_byReference, ZSTD_freeDDict, |
82 | | - ZSTD_getDictID_fromDDict, ZSTD_sizeof_DDict, |
| 114 | + ZSTD_DDict, ZSTD_createDDict, ZSTD_createDDict_byReference, ZSTD_estimateDDictSize, |
| 115 | + ZSTD_freeDDict, ZSTD_getDictID_fromDDict, ZSTD_sizeof_DDict, |
83 | 116 | }, |
84 | 117 | zstd_decompress::{ |
85 | 118 | ZSTD_DCtx_getParameter, ZSTD_DCtx_loadDictionary, ZSTD_DCtx_refDDict, ZSTD_DCtx_refPrefix, |
@@ -116,18 +149,18 @@ pub use crate::lib::compress::zstd_compress::{ |
116 | 149 | ZSTD_CDict, ZSTD_CStreamInSize, ZSTD_CStreamOutSize, ZSTD_EndDirective, ZSTD_cParam_getBounds, |
117 | 150 | ZSTD_compress, ZSTD_compress2, ZSTD_compressBlock, ZSTD_compressBound, ZSTD_compressCCtx, |
118 | 151 | ZSTD_compressStream, ZSTD_compressStream2, ZSTD_compress_usingCDict, ZSTD_compress_usingDict, |
119 | | - ZSTD_copyCCtx, ZSTD_createCCtx, ZSTD_createCDict, ZSTD_createCDict_byReference, ZSTD_endStream, |
120 | | - ZSTD_flushStream, ZSTD_freeCCtx, ZSTD_freeCDict, ZSTD_getBlockSize, ZSTD_getDictID_fromCDict, |
121 | | - ZSTD_getFrameProgression, ZSTD_initCStream, ZSTD_initCStream_srcSize, |
122 | | - ZSTD_initCStream_usingCDict, ZSTD_initCStream_usingDict, ZSTD_maxCLevel, ZSTD_minCLevel, |
123 | | - ZSTD_sequenceBound, ZSTD_sizeof_CCtx, ZSTD_sizeof_CDict, ZSTD_BLOCKSIZE_MAX_MIN, |
124 | | - ZSTD_BLOCKSPLITTER_LEVEL_MAX, ZSTD_CHAINLOG_MAX_32, ZSTD_CHAINLOG_MAX_64, ZSTD_CHAINLOG_MIN, |
125 | | - ZSTD_HASHLOG_MIN, ZSTD_LDM_BUCKETSIZELOG_MAX, ZSTD_LDM_BUCKETSIZELOG_MIN, ZSTD_LDM_HASHLOG_MIN, |
126 | | - ZSTD_LDM_HASHRATELOG_MIN, ZSTD_LDM_MINMATCH_MAX, ZSTD_LDM_MINMATCH_MIN, ZSTD_MINMATCH_MAX, |
127 | | - ZSTD_MINMATCH_MIN, ZSTD_OVERLAPLOG_MAX, ZSTD_OVERLAPLOG_MIN, ZSTD_SEARCHLOG_MIN, |
128 | | - ZSTD_SKIPPABLEHEADERSIZE, ZSTD_SRCSIZEHINT_MIN, ZSTD_TARGETCBLOCKSIZE_MAX, |
129 | | - ZSTD_TARGETCBLOCKSIZE_MIN, ZSTD_TARGETLENGTH_MAX, ZSTD_TARGETLENGTH_MIN, |
130 | | - ZSTD_WINDOWLOG_LIMIT_DEFAULT, ZSTD_WINDOWLOG_MIN, |
| 152 | + ZSTD_copyCCtx, ZSTD_createCCtx, ZSTD_createCDict, ZSTD_createCDict_byReference, |
| 153 | + ZSTD_createCStream, ZSTD_endStream, ZSTD_flushStream, ZSTD_freeCCtx, ZSTD_freeCDict, |
| 154 | + ZSTD_getBlockSize, ZSTD_getDictID_fromCDict, ZSTD_getFrameProgression, ZSTD_initCStream, |
| 155 | + ZSTD_initCStream_srcSize, ZSTD_initCStream_usingCDict, ZSTD_initCStream_usingDict, |
| 156 | + ZSTD_maxCLevel, ZSTD_minCLevel, ZSTD_sequenceBound, ZSTD_sizeof_CCtx, ZSTD_sizeof_CDict, |
| 157 | + ZSTD_BLOCKSIZE_MAX_MIN, ZSTD_BLOCKSPLITTER_LEVEL_MAX, ZSTD_CHAINLOG_MAX_32, |
| 158 | + ZSTD_CHAINLOG_MAX_64, ZSTD_CHAINLOG_MIN, ZSTD_HASHLOG_MIN, ZSTD_LDM_BUCKETSIZELOG_MAX, |
| 159 | + ZSTD_LDM_BUCKETSIZELOG_MIN, ZSTD_LDM_HASHLOG_MIN, ZSTD_LDM_HASHRATELOG_MIN, |
| 160 | + ZSTD_LDM_MINMATCH_MAX, ZSTD_LDM_MINMATCH_MIN, ZSTD_MINMATCH_MAX, ZSTD_MINMATCH_MIN, |
| 161 | + ZSTD_OVERLAPLOG_MAX, ZSTD_OVERLAPLOG_MIN, ZSTD_SEARCHLOG_MIN, ZSTD_SKIPPABLEHEADERSIZE, |
| 162 | + ZSTD_SRCSIZEHINT_MIN, ZSTD_TARGETCBLOCKSIZE_MAX, ZSTD_TARGETCBLOCKSIZE_MIN, |
| 163 | + ZSTD_TARGETLENGTH_MAX, ZSTD_TARGETLENGTH_MIN, ZSTD_WINDOWLOG_LIMIT_DEFAULT, ZSTD_WINDOWLOG_MIN, |
131 | 164 | }; |
132 | 165 |
|
133 | 166 | pub mod internal { |
|
0 commit comments