Expand description
IFF (Interchange File Format) container parser for DjVu files.
This module provides two APIs:
-
New spec-based parser (
parse_form) — zero-copy, borrowing slices from the input byte buffer. Written from the sndjvu.org specification. -
Legacy API (
parse,Chunk,DjvuFile) — the original tree-based parser kept for internal backward compatibility while the rewrite is in progress.
§DjVu IFF layout
[4] magic = "AT&T"
[4] id = "FORM"
[4] length (big-endian u32, covers form_type + all chunks)
[4] form_type = "DJVU" | "DJVM" | "BM44" | "PM44"
... chunksEach inner chunk:
[4] id
[4] length (big-endian u32)
[n] data (padded to even number of bytes if length is odd)Re-exports§
pub use LegacyError as Error;
Structs§
- Djvu
File - A parsed DjVu document (the root FORM chunk).
- Form
- The top-level FORM structure parsed by the spec-based parser.
- IffChunk
- A parsed IFF chunk from the new spec-based parser: a 4-byte identifier plus a zero-copy slice into the original byte buffer.
Enums§
- Chunk
- A parsed IFF chunk — either a FORM container or a leaf data chunk.
- IffError
- Errors that can occur while parsing the IFF container.
- Legacy
Error - Original error type used by the legacy implementation.
Functions§
- emit
- Serialise a
DjvuFile(legacy parser) back into the on-disk IFF byte stream, including the leading “AT&T” magic. - parse
- Parse a DjVu file from raw bytes (legacy tree-based parser).
- parse_
form - Parse a DjVu IFF byte stream into a
Form.
Type Aliases§
- ChunkId
- A 4-byte chunk identifier (e.g., b“FORM“, b“INFO“, b“Sjbz“).