Skip to main content

Module module

Module module 

Source
Expand description

The load module (.iwm) of docs/load-module.md: its container, encoding rules and codec.

Modules§

codec
The codec traits, the writer and reader they use, the §4.1 and §4.4 impls, and the §4.6 macros.
crc
CRC-32: the IEEE polynomial, reflected, initial and final XOR 0xFFFFFFFF (load-module.md §3.3).
leb
Unsigned LEB128 and zigzag (load-module.md §4.1), with only the canonical form accepted.

Structs§

DirectoryEntry
A program’s line in the DIRECTORY section (load-module.md §6).
LirRecord
One program’s record in the LIR section: the fields of Program no other section holds.
LoadedModule
The programs of a module, in ordinal order, with their directory.
Module
A module whose header and table are checked; a section’s checksum is checked when it is read.
ModuleWriter
Builds section bodies in id order; finish puts the string table first and adds the checksums.
Reader
A bounds-checked cursor over one section’s bytes.
Section
A section this version knows (load-module.md §3.4). Every one is required.
SectionEntry
StringTable
The one table of strings a module’s sections refer to by index (load-module.md §4.2).
Version
Writer
Section bytes being built, and the string table they intern into.

Enums§

ModuleError

Constants§

EXTENSIONS
The first id of the extension sections, which are always written optional.
MAGIC
OPTIONAL
Flag bit 0 of a section entry: a reader that does not know the section skips it.

Traits§

Decode
Encode

Functions§

read
Reads and checks a module; the bytes of every section are checksummed.
write
A module of programs, each a top-level program in the directory. Same input, same bytes.
write_with
A module with the caller’s directory, refused (as the reader would) if it or a program is invalid.

Type Aliases§

LayoutRecord
One program’s record in the LAYOUT section.