Expand description
Wire layout primitives: the fixed header, node records, section table and the limits that bound untrusted input.
Everything here is a pure description of bytes; the normative document is
docs/spec/layout.md, and tests/doc_gate.rs fails the build if constants
and prose drift apart.
Structs§
- Decode
Opts - Decode options.
- Encode
Opts - Encode options.
- Header
- Parsed fixed header.
- Limits
- Decode limits applied to every untrusted buffer.
- Meta
- Metadata describing a validated image, returned by
validate. - Section
Span - Offset and element count (or byte length) of one section.
Enums§
- Section
- Ordinal of a section in the canonical image. Sections appear in this exact order, each starting at an 8-byte aligned offset with no gaps.
Constants§
- ANNOTATION_
SIZE - Annotation entry size.
- ANN_
KIND_ AI_ IMMUTABLE - Annotation kind:
AiImmutable. - ANN_
KIND_ CONSTRAINT - Annotation kind:
Constraint. - ANN_
KIND_ INTENT - Annotation kind:
Intent. - AUX_
CONSTRAINT_ CUSTOM - Custom constraint payload; value is a string id.
- AUX_
CONSTRAINT_ ENUM_ ITEM - Constraint enum member; value is a string id.
- AUX_
CONSTRAINT_ MAX - Constraint
maxbound; value is anumbersindex. - AUX_
CONSTRAINT_ MIN - Constraint
minbound; value is anumbersindex. - AUX_
CONSTRAINT_ PATTERN - Constraint regex pattern; value is a string id.
- AUX_
PATCH_ PATH - Patch target path; value is a string id.
- AUX_
PATCH_ RENAME_ TO - Patch rename destination; value is a string id.
- AUX_
PATCH_ VALUE - Patch value node; value is a node id.
- AUX_
SCHEMA_ DEFAULT - Schema field
defaultnode. - AUX_
SCHEMA_ DEPRECATED - Schema field
deprecatedmessage; value is a string id. - AUX_
SCHEMA_ MAX - Schema field
maxnode. - AUX_
SCHEMA_ MAX_ LEN - Schema field
max_lennode. - AUX_
SCHEMA_ MIN - Schema field
minnode. - AUX_
SCHEMA_ MIN_ LEN - Schema field
min_lennode. - AUX_
SCHEMA_ PATTERN - Schema field
patternnode. - AUX_
SIZE - Aux record size.
- AUX_
TYPE_ ENUM_ ITEM - Enum type member; value is a string id.
- AUX_
TYPE_ TABLE - Table type closed flag; value is
0or1. - BLOB_
ENTRY_ SIZE - Blob index entry size.
- CANONICAL_
NAN_ BITS - The one NaN bit pattern the format permits.
- CHILD_
SIZE - Child index entry size.
- CONSTRAINT_
KIND_ CUSTOM - Constraint kind:
Custom. - CONSTRAINT_
KIND_ ENUM - Constraint kind:
Enum. - CONSTRAINT_
KIND_ MIN_ MAX - Constraint kind:
MinMax. - CONSTRAINT_
KIND_ ODD - Constraint kind:
Odd. - CONSTRAINT_
KIND_ PATTERN - Constraint kind:
Pattern. - EDGE_
SIZE - Edge entry size.
- EXT_
DIR_ SIZE - Extension directory entry size.
- FIELD_
SIZE - Table field entry size: name string id + node id + two pad words.
- FLAG_
ANNOTATIONS - Header flag: an annotation table is present.
- FLAG_
CANONICAL - Header flag: the image is in canonical form (self-declaration the reader verifies).
- FLAG_
EXTENSIONS - Header flag: an extension directory is present.
- FLAG_
KNOWN_ MASK - All flags this reader understands.
- FLAG_
PROVENANCE - Header flag: a provenance block is present.
- FLAG_
SECRETS - Header flag: a secret table is present.
- FLAG_
STREAMED - Header flag: the module was reassembled from a stream.
- FORMAT_
MAJOR - Major format version implemented by this crate.
- FORMAT_
MINOR - Minor format version implemented by this crate.
- HEADER_
SIZE - Fixed header size in bytes.
- MAGIC
- Magic at offset 0:
A I N F. - NODE_
FLAG_ 0 - Node flag bit 0 (meaning depends on kind).
- NODE_
FLAG_ 1 - Node flag bit 1.
- NODE_
FLAG_ 2 - Node flag bit 2.
- NODE_
FLAG_ 3 - Node flag bit 3.
- NODE_
FLAG_ 4 - Node flag bit 4.
- NODE_
FLAG_ 5 - Node flag bit 5.
- NODE_
FLAG_ 6 - Node flag bit 6.
- NODE_
FLAG_ KNOWN - All node flag bits (bit 7 is reserved and must be zero).
- NODE_
RECORD_ SIZE - Fixed node record size in bytes.
- NUM_
SIZE - Numeric side-table entry size.
- PART_
EXPR - Interpolation part: expression; value is a node id.
- PART_
LITERAL - Interpolation part: literal string; value is a string id.
- PART_
SIZE - Interpolation part entry size.
- PATCH_
KIND_ REMOVE - Patch kind:
Remove. - PATCH_
KIND_ RENAME - Patch kind:
Rename. - PATCH_
KIND_ SET - Patch kind:
Set. - PROV_
ENTRY_ SIZE - Provenance entry size.
- PROV_
HEADER_ SIZE - Provenance block fixed header size.
- SECRET_
ENTRY_ SIZE - Secret table entry size.
- SECTION_
COUNT - Number of sections in the canonical image.
- STREAM_
MAGIC - Stream frame magic:
A I N S. - TYPE_
SIZE - Type table entry size.
- UNIT_
SIZE - Unit table entry size.
Functions§
- align8
- Round
valueup to the next multiple of 8. - canonical_
f64 - Canonical form of a float:
-0.0becomes+0.0; every NaN becomes the single quiet NaN0x7ff8_0000_0000_0000. - dialect_
hash - The dialect this build implements: a hash over the format version and the semantic tables (unit discriminants, node kinds, aux tags). Stored in every header so a peer can refuse a module produced by an incompatible build before parsing a single record.
- pad8
- Pad
outwith zero bytes to the next 8-byte boundary. - put_u16
- Write helpers used by the encoder.
- put_u32
- put_u64
- read_
u32 - Read a little-endian
u32, mapping short input to a truncation error. - read_
u64 - Read a little-endian
u64, mapping short input to a truncation error.