Expand description
Minimal safe wrapper around zstd-sys.
This crates provides a minimal translation of the zstd-sys methods. For a more comfortable high-level library, see the zstd crate.
Most of the functions here map 1-for-1 to a function from the C zstd library mentioned in their descriptions. Check the source documentation for more information on their behaviour.
Features denoted as experimental in the C library are hidden behind an
experimental
feature.
Re-exports§
pub use zstd_sys;
Structs§
- CCtx
- Compression context
- CDict
- Compression dictionary.
- Content
Size Error - Indicates an error happened when parsing the frame content size.
- DCtx
- A Decompression Context.
- DDict
- A digested decompression dictionary.
- InBuffer
- Wrapper around an input buffer.
- OutBuffer
- Wrapper around an output buffer.
Enums§
- CParameter
- A compression parameter.
- DParameter
- A decompression parameter.
- Dict
Attach Pref experimental
- Frame
Format experimental
- Param
Switch experimental
- Reset
Directive - What kind of context reset should be applied.
- Strategy
- How to compress data. Advanced compression API (Requires v1.4.0+)
Constants§
- BLOCKSIZELOG_
MAX - BLOCKSIZE_
MAX - BLOCKSIZE_
MAX_ MIN - CHAINLOG_
MAX_ 32 - CHAINLOG_
MAX_ 64 - CHAINLOG_
MIN - CLEVEL_
DEFAULT - CONTENTSIZE_
ERROR - CONTENTSIZE_
UNKNOWN - FRAMEHEADERSIZE_
MAX - HASHLOG_
MIN - LDM_
BUCKETSIZELOG_ MAX - LDM_
BUCKETSIZELOG_ MIN - LDM_
HASHLOG_ MIN - LDM_
HASHRATELOG_ MIN - LDM_
MINMATCH_ MAX - LDM_
MINMATCH_ MIN - MAGICNUMBER
- MAGIC_
DICTIONARY - MAGIC_
SKIPPABLE_ MASK - MAGIC_
SKIPPABLE_ START - MINMATCH_
MAX - MINMATCH_
MIN - OVERLAPLOG_
MAX - OVERLAPLOG_
MIN - SEARCHLOG_
MIN - SKIPPABLEHEADERSIZE
- SRCSIZEHINT_
MIN - TARGETCBLOCKSIZE_
MAX - TARGETCBLOCKSIZE_
MIN - TARGETLENGTH_
MAX - TARGETLENGTH_
MIN - VERSION_
MAJOR - VERSION_
MINOR - VERSION_
NUMBER - VERSION_
RELEASE - WINDOWLOG_
LIMIT_ DEFAULT - WINDOWLOG_
MAX_ 32 - WINDOWLOG_
MAX_ 64 - WINDOWLOG_
MIN
Traits§
- Write
Buf - Describe a bytes container, like
Vec<u8>
.
Functions§
- compress
- Wraps the
ZSTD_compress
function. - compress_
bound - Maximum compressed size in worst case single-pass scenario
- compress_
using_ cdict - Wraps the
ZSTD_compress_usingCDict()
function. - create_
cdict - Wraps the
ZSTD_createCDict()
function. - create_
cstream - Allocates a new
CStream
. - create_
ddict - Wraps the
ZSTD_createDDict()
function. - decompress
- Wraps the
ZSTD_decompress
function. - decompress_
bound experimental
- Wraps the
ZSTD_decompressBound
function - decompress_
using_ ddict - Wraps the
ZSTD_decompress_usingDDict()
function. - decompression_
margin experimental
- Returns the minimum extra space when output and input buffer overlap.
- find_
decompressed_ size experimental
- Wraps the
ZSTD_findDecompressedSize()
function. - find_
frame_ compressed_ size - Wraps the
ZSTD_findFrameCompressedSize()
function. - get_
block_ size experimental
- Wraps the
ZSTD_getBlockSize()
function. - get_
decompressed_ size Deprecated - Wraps the
ZSTD_getDecompressedSize
function. - get_
dict_ id zdict_builder
- Wraps the
ZDICT_getDictID()
function. - get_
dict_ id_ from_ dict - Wraps the
ZSTD_getDictID_fromDict()
function. - get_
dict_ id_ from_ frame - Wraps the
ZSTD_getDictID_fromFrame()
function. - get_
error_ name - Returns the error string associated with an error code.
- get_
frame_ content_ size - Wraps the
ZSTD_getFrameContentSize()
function. - init_
cstream - Prepares an existing
CStream
for compression at the given level. - is_
frame experimental
- Wraps the
ZSTD_isFrame()
function. - max_
c_ level - Returns the maximum (slowest) compression level supported.
- min_
c_ level - Returns the minimum (fastest) compression level supported.
- sequence_
bound experimental
- Given a buffer of size
src_size
, returns the maximum number of sequences that can ge generated. - train_
from_ buffer zdict_builder
- Wraps the
ZDICT_trainFromBuffer()
function. - version_
number - Returns the ZSTD version.
- version_
string - Returns a string representation of the ZSTD version.
Type Aliases§
- CStream
- Compression stream.
- Compression
Level - Represents the compression level used by zstd.
- DStream
- A Decompression stream.
- Error
Code - Represents a possible error from the zstd library.
- Safe
Result - Wrapper result around most zstd functions.