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.
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
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 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_using_ddict
Wraps the ZSTD_decompress_usingDDict() function.
find_frame_compressed_size
Wraps the ZSTD_findFrameCompressedSize() function.
get_decompressed_sizeDeprecated
Wraps the ZSTD_getDecompressedSize 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.
max_c_level
Returns the maximum (slowest) compression level supported.
min_c_level
Returns the minimum (fastest) compression level supported.
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.