Skip to main content

Module encoding

Module encoding 

Source
Expand description

Structures and utilities used for compressing/encoding data into the Zstd format.

Structs§

CompressionLevel
A validated Zstandard compression level.
CompressionTuning
Optional low-level tuning layered over a super::CompressionLevel preset.
Encoderstd
A bounded-memory Zstandard encoder implementing Write.
EncoderDictionarystd
An owned, parsed dictionary reusable across independent frames.
EncoderOptionsstd
Configuration for the bounded-memory streaming encoder.
EncoderWorkspace
An owned compression workspace reusable without further allocation.
FrameCompressor
An interface for compressing arbitrary data with the ZStandard compression algorithm.
InvalidCompressionLevel
Error returned when a numeric compression level is outside the supported fast or positive ranges.
LongDistanceMatching
Typed long-distance matching controls.
MatchGeneratorDriver
This is the default implementation of the Matcher trait. It allocates and reuses the buffers when possible.
StaticEncoderWorkspace
A compression context whose working state lives entirely in caller storage.

Enums§

CompressionFileType
Coarse file families used to choose the encoder’s internal starting point.
CompressionStrategy
Stable strategy choices understood by the native Rust compressor.
ContentSizePolicy
Controls whether each independently emitted frame declares its decoded size.
DictionaryErrorstd
Error returned when dictionary bytes are not a usable Zstandard dictionary.
EncodeErrorstd
Errors produced by the bounded streaming API.
EncoderWorkspaceError
Errors reported while creating or using an encoder workspace.
Sequence
Sequences that a Matcher can produce

Constants§

DEFAULT_FRAME_CHUNK_SIZEstd
Default amount of input stored in each independent Zstandard frame: 8 MiB.
DEFAULT_MEMORY_LIMITstd
Default maximum estimated resident working set: 96 MiB.

Traits§

Matcher
Trait used by the encoder that users can use to extend the matching facilities with their own algorithm making their own tradeoffs between runtime, memory usage and compression ratio

Functions§

compress
Convenience function to compress some source into a target without reusing any resources of the compressor
compress_to_vec
Convenience function to compress some source into a Vec without reusing any resources of the compressor
compress_to_vec_with_file_type
Convenience function to compress some source into a Vec using a coarse file-type hint.
compress_to_vec_with_pathstd
Convenience function to compress some source into a Vec using a path-based file-type hint.
compress_with_file_type
Convenience function to compress some source into a target using a coarse file-type hint.
compress_with_pathstd
Convenience function to compress some source into a target using a path-based file-type hint.
compression_file_type_for_pathstd
compression_file_type_for_path_and_datastd
Classify using path first, then sample bytes if the path does not resolve to a known family.
encodestd
Streams all input into a bounded-memory encoder.
encode_allstd
Compresses all input and returns the resulting Zstandard archive.