Skip to main content

Module schema

Module schema 

Source
Expand description

Schema model, builder, canonical binary encoding (“VSC1”), and content hashing. The canonical form sorts types by name, fields by ID, and enum variants by value, so one logical schema has exactly one byte encoding and therefore exactly one id.

Structs§

EnumDef
FieldDef
Schema
A validated schema: canonical type table, cached canonical bytes, content id, and precomputed struct layouts.
SchemaBuilder
Declaration order never matters: build sorts types by name and fields by ID before encoding, so equivalent declarations produce identical schema ids.
StructDef

Enums§

Default
A scalar custom default for a field: the value a reader synthesizes when the field is absent (see StructReader::get_or_default). v1 supports scalar defaults only; floats are stored as their bit patterns so the schema types stay Eq.
Dt
Draft type used in SchemaBuilder: like Type but names other types by string instead of index (indices only exist after canonical sorting).
StructMode
How a struct’s fields are stored.
Type
A field or element type. Struct/Enum reference other types in the same schema by index into the canonically (name-)sorted type table.
TypeDef

Constants§

MAX_TYPE_DEPTH
Maximum list<…> nesting depth. Bounds recursion in schema decode and in resolver plan-building so a hostile schema cannot overflow the stack. Far above any real schema (a handful of levels).
SCHEMA_MAGIC