Crate zstd_safe

Source
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.
ContentSizeError
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.
DictAttachPrefexperimental
FrameFormatexperimental
ParamSwitchexperimental
ResetDirective
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§

WriteBuf
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_boundexperimental
Wraps the ZSTD_decompressBound function
decompress_using_ddict
Wraps the ZSTD_decompress_usingDDict() function.
decompression_marginexperimental
Returns the minimum extra space when output and input buffer overlap.
find_decompressed_sizeexperimental
Wraps the ZSTD_findDecompressedSize() function.
find_frame_compressed_size
Wraps the ZSTD_findFrameCompressedSize() function.
get_block_sizeexperimental
Wraps the ZSTD_getBlockSize() function.
get_decompressed_sizeDeprecated
Wraps the ZSTD_getDecompressedSize function.
get_dict_idzdict_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_frameexperimental
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_boundexperimental
Given a buffer of size src_size, returns the maximum number of sequences that can ge generated.
train_from_bufferzdict_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.
CompressionLevel
Represents the compression level used by zstd.
DStream
A Decompression stream.
ErrorCode
Represents a possible error from the zstd library.
SafeResult
Wrapper result around most zstd functions.