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
CDict
Compression dictionary.
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.
ResetDirective
Reset directive.
Strategy
How to compress data. Advanced compression API (Requires v1.4.0+)

Constants§

BLOCKSIZELOG_MAX
BLOCKSIZE_MAX
CLEVEL_DEFAULT
CONTENTSIZE_ERROR
CONTENTSIZE_UNKNOWN
MAGICNUMBER
MAGIC_DICTIONARY
MAGIC_SKIPPABLE_MASK
MAGIC_SKIPPABLE_START
VERSION_MAJOR
VERSION_MINOR
VERSION_NUMBER
VERSION_RELEASE

Traits§

WriteBuf
Describe a resizeable bytes container like Vec<u8>.

Functions§

cctx_load_dictionary
Wraps the ZSTD_CCtx_loadDictionary() function.
cctx_ref_cdict
Wraps the ZSTD_CCtx_refCDict() function.
cctx_ref_prefix
Wraps the ZSTD_CCtx_refPrefix() function.
cctx_reset
Wraps the ZSTD_CCtx_reset() function.
cctx_set_parameter
Wraps the ZSTD_CCtx_setParameter() function.
cctx_set_pledged_src_size
Wraps the ZSTD_CCtx_setPledgedSrcSize() function.
compress
Wraps the ZSTD_compress function.
compress2
Wraps the ZSTD_compress2() function.
compress_bound
maximum compressed size in worst case single-pass scenario
compress_cctx
Wraps the ZSTD_compressCCtx() function
compress_stream
Wraps the ZSTD_compressStream() function.
compress_stream2
compress_using_cdict
Wraps the ZSTD_compress_usingCDict() function.
compress_using_dict
Wraps the ZSTD_compress_usingDict() function.
create_cctx
create_cdict
Wraps the ZSTD_createCDict() function.
create_cstream
Allocates a new CStream.
create_dctx
Prepares a new decompression context without dictionary.
create_ddict
Wraps the ZSTD_createDDict() function.
create_dstream
cstream_in_size
Wraps ZSTD_CStreamInSize()
cstream_out_size
Wraps ZSTD_CStreamOutSize()
dctx_load_dictionary
Wraps the ZSTD_DCtx_loadDictionary() function.
dctx_ref_ddict
Wraps the ZSTD_DCtx_refDDict() function.
dctx_ref_prefix
Wraps the ZSTD_DCtx_refPrefix() function.
dctx_reset
Wraps the ZSTD_DCtx_reset() function.
dctx_set_parameter
Wraps the ZSTD_DCtx_setParameter() function.
decompress
Wraps the ZSTD_decompress function.
decompress_dctx
Wraps the ZSTD_decompressDCtx() function.
decompress_stream
Wraps the ZSTD_decompressStream() function.
decompress_using_ddict
Wraps the ZSTD_decompress_usingDDict() function.
decompress_using_dict
Wraps the ZSTD_decompress_usingDict() function.
dstream_in_size
Wraps the ZSTD_DStreamInSize() function.
dstream_out_size
Wraps the ZSTD_DStreamOutSize() function.
end_stream
Wraps the ZSTD_endStream() function.
find_frame_compressed_size
Wraps the ZSTD_findFrameCompressedSize() function.
flush_stream
Wraps the ZSTD_flushStream() function.
get_decompressed_sizeDeprecated
Wraps the ZSTD_getDecompressedSize function.
get_dict_id
Wraps the ZSTD_getDictID_fromDict() function.
get_dict_id_from_ddict
Wraps the ZSTD_getDictID_fromDDict() 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
get_frame_content_size
Wraps the ZSTD_getFrameContentSize() function.
init_cstream
Prepares an existing CStream for compression at the given level.
init_dstream
Wraps the ZSTD_initCStream() function.
max_c_level
Returns the maximum (slowest) compression level supported.
min_c_level
Returns the minimum (fastest) compression level supported.
sizeof_cctx
Wraps the ZSTD_sizeofCCtx() function.
sizeof_cdict
Wraps the ZSTD_sizeof_CDict() function.
sizeof_cstream
Wraps the ZSTD_sizeof_CStream() function.
sizeof_dctx
Wraps the ZSTD_sizeof_DCtx() function.
sizeof_ddict
Wraps the ZSTD_sizeof_DDict() function.
sizeof_dstream
Wraps the ZSTD_sizeof_DStream() function.
train_from_buffer
Wraps the ZDICT_trainFromBuffer() function.
version_number
version_string

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.