packkit/recipe
Types
Opaque archive+codec composition. Every public Recipe carries
an archive layer; the raw byte-to-byte path is served by the
codec-only packkit.compress / packkit.decompress entrypoints
rather than by a “headless” recipe variant, so values constructed
here cannot represent unusable states.
reversed_codecs stores codecs in outer-to-inner order so [wrap]
runs in O(1); accessors reverse on read.
pub opaque type Recipe
Values
pub fn ar() -> Recipe
Convenience constructor for a bare ar archive (BSD long-name
format on encode; GNU string-table form also accepted on decode).
pub fn archive_format(recipe: Recipe) -> archive.ArchiveFormat
Read the archive format the recipe was constructed with.
pub fn archive_only(
format format: archive.ArchiveFormat,
) -> Recipe
Create a recipe that carries an archive but no outer codec yet.
pub fn archive_with(
format format: archive.ArchiveFormat,
wrapped_by wrapped_by: codec.Codec,
) -> Recipe
Create a recipe with an archive and one outer codec.
pub fn codecs(recipe: Recipe) -> List(codec.Codec)
Read the codec chain in inner-to-outer order.
pub fn cpio_bzip2() -> Recipe
cpio.bz2 recipe — cpio body, bzip2-compressed envelope.
pub fn description(recipe: Recipe) -> String
Human-readable canonical description for debugging and tests.
pub fn outermost_codec(
recipe: Recipe,
) -> option.Option(codec.Codec)
Read the outermost codec, if any.
pub fn seven_z() -> Recipe
Convenience constructor for a bare 7z archive. Like ZIP, 7z applies its own internal compression and does not take a recipe codec wrapper; this constructor keeps the API symmetric across archive families.
pub fn tar() -> Recipe
Convenience constructor for a bare tar archive (no outer codec).
Equivalent to archive_only(format: archive.tar()); provided so
the same packkit.pack / packkit.unpack entrypoints serve both
uncompressed tar and codec-wrapped tar without the caller switching
to packkit.write / packkit.read.
pub fn tar_brotli() -> Recipe
Convenience constructor for tar.br. Round-trips end-to-end via
brotli’s uncompressed-metablock encoder; the bytes are valid for
any conforming brotli decoder but do no actual LZ77/Huffman
compression yet.
pub fn wrap(
recipe: Recipe,
with outer_codec: codec.Codec,
) -> Recipe
Wrap an existing recipe in one more outer codec. O(1) thanks to the reversed internal codec list.
pub fn zip() -> Recipe
Convenience constructor for a bare ZIP archive. ZIP carries its
own per-entry compression internally, so there’s no recipe-level
codec to wrap it in — but exposing recipe.zip() lets callers use
the same packkit.pack / packkit.unpack API they use for tar
recipes, instead of switching to packkit.write / packkit.read.