Skip to main content

Module bif

Module bif 

Source
Expand description

BIF archive support. BIF binary reader and writer.

BIF (BIFF) files are archive containers referenced by KEY indexes. Each entry stores only (resource_id, type_id, payload); names/resrefs are resolved through KEY metadata.

§Shape of the container

A fixed 20-byte header, a variable resource table located by variable_table_offset, an optional fixed resource table directly after it, and the payload addressed per entry.

Nothing here carries a name. An entry knows its id, type, offset and size; the resref lives in the KEY, which reaches in by position. That is why a BIF cannot be read on its own.

The fixed table is a format feature nothing uses: fixed_count is zero in all 26 archives of a vanilla install, and the engine ignores the scalar anyway. The table is parsed when present so such a file round-trips.

Compressed .bzf archives are gated behind the crate feature bzf and read through BifIndex, which takes the container kind from the caller rather than guessing it from content – nothing inside a compressed file distinguishes it.

Byte-level field maps for the header and both entry records, the compressed variant and its LZMA payload framing, and the engine’s own load sequence live in docs/src/formats/archives/bif.md.

Structs§

Bif
In-memory BIF archive.
BifIndex
A lazily-read BIF archive.
BifIndexEntry
One indexed resource: its identity and where its bytes live.
BifReadOptions
BIF reader option set.
BifResource
One resource entry stored in a BIF archive.

Enums§

BifBinaryError
Errors produced while parsing or serializing BIF binary data.
BifContainer
BIF container kind.
BifReadMode
BIF reader input policy.
BifResourceStorage
Storage table kind for a BifResource.

Functions§

read_bif
Reads a BIF archive from a reader.
read_bif_from_bytes
Reads a BIF archive from bytes.
read_bif_from_bytes_with_options
Reads a BIF archive from bytes with explicit options.
read_bif_with_options
Reads a BIF archive from a reader with explicit options.
write_bif
Writes a BIF archive to a writer.
write_bif_to_vec
Serializes a BIF archive to bytes.