Skip to main content

Module layout

Module layout 

Source
Expand description

Static field-offset table for the host <-> wasm binary handshake.

Spec: docs/internal/adr/wasm-binary-layout-v1-2026-05-16.md, “basic type layout” + “slot alignment rule” sections.

v1 scope (Phase 2.a / 2.b / 2.c):

  • Phase 2.a / 2.b: the four scalar leaves — Int, Float, Bool, Unit — are laid out inline. Each field’s start offset is rounded up to its alignment; the root is padded to root_align so the next record starts aligned.
  • Phase 2.c+: variable fields (String, List<T>, nested schemas, Option<T>, and Result<T, E>) use pointer indirection. Each contributes a fixed-area u32 pointer slot (size = 4, align = 4); the payload lives in a tail area the crate::buffer::BufferBuilder appends after the root record.

Structs§

FieldOffset
One field’s slot inside a record.
OffsetTable
Computed offset table for a schema’s flat record area.
SchemaLayout
Schema-level layout entry point. Computes the offset table for the flat record area; tail-area layout (for String / List in Phase 2.b) will be returned through a sibling helper once those types land.

Enums§

FieldKind
How a field is stored relative to the buffer record.
LayoutError
Reasons offset computation can fail.
ListElementKind
Phase 10-c: per-element layout descriptor for a List<T> field.