Skip to main content

Module layout

Module layout 

Source
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§

DecodeOpts
Decode options.
EncodeOpts
Encode options.
Header
Parsed fixed header.
Limits
Decode limits applied to every untrusted buffer.
Meta
Metadata describing a validated image, returned by validate.
SectionSpan
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 max bound; value is a numbers index.
AUX_CONSTRAINT_MIN
Constraint min bound; value is a numbers index.
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 default node.
AUX_SCHEMA_DEPRECATED
Schema field deprecated message; value is a string id.
AUX_SCHEMA_MAX
Schema field max node.
AUX_SCHEMA_MAX_LEN
Schema field max_len node.
AUX_SCHEMA_MIN
Schema field min node.
AUX_SCHEMA_MIN_LEN
Schema field min_len node.
AUX_SCHEMA_PATTERN
Schema field pattern node.
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 0 or 1.
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 value up to the next multiple of 8.
canonical_f64
Canonical form of a float: -0.0 becomes +0.0; every NaN becomes the single quiet NaN 0x7ff8_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 out with 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.