packkit/codec
Types
Pattern-matchable tag identifying the codec family. Codec itself
is still opaque; this transparent enum is the internal taxonomy the
facade uses for compile-time-checked dispatch.
pub type CodecKind {
Identity
Deflate
Zlib
Gzip
Lz4
Snappy
Bzip2
Lzw
Xz
Zstd
Brotli
}
Constructors
-
Identity -
Deflate -
Zlib -
Gzip -
Lz4 -
Snappy -
Bzip2 -
Lzw -
Xz -
Zstd -
Brotli
Preset dictionary bytes used by codecs that support them.
pub opaque type Dictionary
Values
pub fn bzip2() -> Codec
BZip2 stream. Defaults to level 9 (900 KiB block size) to match
the canonical bzip2 default and the level bzip2.encode uses
when no level is supplied explicitly.
pub fn dictionary(bytes bytes: BitArray) -> Dictionary
Build a dictionary value from raw bytes.
pub fn dictionary_bytes(dict: Dictionary) -> BitArray
Access the raw bytes stored in a dictionary.
pub fn dictionary_of(codec: Codec) -> option.Option(Dictionary)
Optional dictionary.
pub fn has_dictionary(codec: Codec) -> Bool
True when a codec carries a preset dictionary.
pub fn name(codec: Codec) -> String
Codec family name. Kept for diagnostics and description output;
internal dispatch uses [kind].
pub fn with_dictionary(
codec: Codec,
dictionary dictionary: Dictionary,
) -> Codec
Attach a preset dictionary.
pub fn with_level(
codec: Codec,
level level: level.Level,
) -> Codec
Override the codec’s compression level.