Skip to main content

Module export

Module export 

Source
Expand description

What a preset may contain, as a machine-readable document (Plan 0158 Phase 4).

A studio building a parameter panel, an expression editor or a table form has to know two things the engine already knows: every parameter a system and the engine stages accept, and every key a structural table accepts. Both are declared in the engine and read by the loader; this renders them.

§The parameter half is generated, not restated

It walks the same ParamSpec declarations the generated block in presets/README.md is rendered from (ADR-0170) — the same rosters, in the same order — so the published table and this document cannot disagree about a name, a default or a range. core/tests/preset.rs renders both from one walk and asserts they agree.

§The structural half is declared beside its serde struct

Every [table] a preset may write carries a TableDesc next to the Raw* struct the loader deserializes it into. That is a second statement of the table’s shape and it is one on purpose: serde carries a field’s name and type, and none of what an editor needs — the closed roster a string is drawn from, the default the loader substitutes, the sentence that says what the key does. What stops the two drifting is a test, not a construction: core/src/preset/schema/tests.rs reads the field roster serde derived (through a Deserializer that answers nothing and records what it was asked for) and asserts it is exactly what the descriptor names.

No enumeration is written here. A KeyKind::Roster names the type that owns the closed set, and Roster::values asks it — so [feedback] warp’s roster is Warp::ALL and there is nothing here to fall out of step with it.

§The hash

hash is FNV-1a over the document body — everything the export declares, without the hash field itself, which would otherwise be hashing its own output. A studio compares it against the one a player reports in hello to know whether the schema it built its panels from is the schema the player is running.

No JSON crate: the writer below is thirty lines and NFR section 4’s dependency gate asks for a justification longer than that.

Structs§

KeyDesc
One key of one structural table.
TableDesc
One structural table a preset may write.

Enums§

KeyKind
What one structural key accepts.
Roster
A closed roster of accepted spellings, named by the type that owns it.

Constants§

SCHEMA_VERSION
The document format’s own version, carried as v so a consumer can refuse a shape it does not know. Independent of the workspace version and of the event stream’s v: this one moves when the document changes shape, which is rarer than either.
STAGE_LABELS
The engine-wide stages, labelled as a reader meets them rather than as the modules are named.
TABLES
Every table, root first. A KeyKind::Table names one of these.

Functions§

document
The whole schema as JSON, hash included.
hash
The document’s stable hash.
hash_hex
The hash as the sixteen hex characters document prints and hello reports.
hash_str
FNV-1a, 64-bit, over text’s bytes — the function hash uses, exposed so a test can hash a deliberately perturbed copy of the document and assert the hash moved with it.
param_rosters
Every parameter roster a preset may bind, labelled: one per system, then one per engine stage.
stage_count
How many of the rosters are engine stages rather than systems — the tail of param_rosters.
table
The table named name, or None.