packkit/codec

Types

Opaque byte-to-byte codec configuration.

pub opaque type Codec

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 brotli() -> Codec

Brotli stream.

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 clear_dictionary(codec: Codec) -> Codec

Remove any preset dictionary.

pub fn clear_level(codec: Codec) -> Codec

Remove any explicit level override.

pub fn deflate() -> Codec

Raw deflate stream.

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 gzip() -> Codec

Gzip wrapper over deflate.

pub fn has_dictionary(codec: Codec) -> Bool

True when a codec carries a preset dictionary.

pub fn identity() -> Codec

No-op codec useful for testing and raw recipe assembly.

pub fn kind(codec: Codec) -> CodecKind

Internal tagged kind for the codec family.

pub fn level(codec: Codec) -> option.Option(level.Level)

Optional level override.

pub fn lz4() -> Codec

LZ4 frame format.

pub fn lzw() -> Codec

Unix LZW .Z stream.

pub fn name(codec: Codec) -> String

Codec family name. Kept for diagnostics and description output; internal dispatch uses [kind].

pub fn snappy() -> Codec

Snappy framed format.

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.

pub fn xz() -> Codec

XZ stream.

pub fn zlib() -> Codec

Zlib wrapper over deflate.

pub fn zstd() -> Codec

Zstandard stream.

Search Document