Skip to main content

Module options

Module options 

Source
Expand description

The OPTIONS SPINE: what a graph root’s own name becomes when a deployment configures it.

ⓘ
#[ingraph::graph]
pub struct Media {
  videos: Video,
  scenes: Scene,
}

emits, beside the walk, a typed MediaOptions — one field per DECLARED node, named by the mount the declaration wrote, holding that node’s own [AsyncConstructor::Options] under a section:

ⓘ
pub struct MediaOptions {
  pub(crate) videos: Option<NodeSection<<Video as AsyncConstructor>::Options>>,
  pub(crate) scenes: Option<NodeSection<<Scene as AsyncConstructor>::Options>>,
}

§PRESENCE IS ENABLEMENT, and that is what the Option is

An application DECLARES a catalog and a deployment LAUNCHES a subset, so a node with no section is a node that does not start. The sleeping catalog costs no boilerplate and a node added in code runs nowhere until somebody names it — which is the design rather than a hazard. Every field is serde(default), so a document naming three of thirty nodes parses and the other twenty-seven are absent rather than malformed.

It is the ONLY enablement axis. A section carries no switch to hold a written node back, because a configuration file is an immutable artifact: a deployment that wants a node off points at a different file rather than toggling this one.

§The RESOURCES ride under ONE key

A root’s #[ingraph(resource)] fields are on the same list as its nodes, and the document groups them: the spine grows one resources field holding a <Root>Resources block, so a deployment writes [resources.egemma] rather than a section at the top level. That is what makes resources a reserved mount — a node named resources would be a second meaning for the same key, and the derive refuses one. crate::catalog emits the block; this emits the field that holds it, and only where the root declares a resource that has a section at all.

§The REGISTRY seat is the SECOND reserved key, and it is on EVERY root

Beside resources the spine grows one registry field, holding [RegistryOptions] — the deployment-wide timing the root-key registry runs under: [registry]’s own defaults, and whatever families it named their own words for under [registry.<family>]. Unlike resources it is on every root whether or not one is declared for, because there is no per-root marker that would make it conditional — every graph gets the registry’s defaults, whether or not anything reads them yet. registry is therefore RESERVED the same way resources is: a member mounted there would be a second meaning for the key, and the derive refuses one by name.

§The RETIRED seat is the THIRD reserved key, and it is CONDITIONAL

A root that wrote retired(<engine>) grows one retired field, holding [RetiredOptions] — the connection its retirement ledger is opened on. Unlike registry it is conditional, and the difference is what a ledger IS: the registry runs on every root whether or not a document tunes it, while a root that declared no ledger has no engine, no connection and no table, so a [retired] section on it would be a document key naming nothing. The NAME is reserved unconditionally all the same, on resources’ own posture — a member called retired would have to be renamed the day its root declares a ledger.

Beside the field the spine grows one associated const, RETIRED_ENGINE, which is the word’s own answer carried across to whatever builds the store. It is a const rather than a field because an engine is not a thing a document may say: it decides what the program COMPILES, and a document is read after the program is built.

§The GENERATIONS seat is the FOURTH, on exactly that shape

A root that wrote generations(<engine>) grows one generations field holding GenerationsOptions — the connection its current pointers are opened on, and how many generations a closure keeps — plus one GENERATIONS_ENGINE const beside it. Everything the retired seat’s two paragraphs argue holds here word for word: conditional FIELD, unconditional NAME, and the engine as a const because a document is read after the program is built.

§The BRIDGE to the launch floor

Beside the accessors, the spine emits one enablement() — the deployment’s sections read into the launch layer’s own Enablement, one call per DECLARED mount. That is the whole of how a document reaches the validate walk: the walk asks about node NAMES, the spine’s fields ARE those names, and a field left None is the node this deployment does not launch.

§ONE schema, and no second document to keep in step

The field NAMES are the mount names, so a section’s key is the same word the declaration wrote — there is no map from string to node to maintain, and a rename moves both ends at once. deny_unknown_fields is what turns a typo into a refusal naming the field, at deserialization, where the reader is looking at the file. What a section CONTAINS is the node author’s own options type reached through the trait, so the deployment’s schema is the sum of the authors’ schemas and this emitter invents no part of it.

§The framework does NO file I/O

What is emitted is a plain serde::Deserialize type. Which format a deployment writes, how many layers it merges, where the file lives and what an environment variable overrides are all the APPLICATION’s business — this crate hands it a type and reads nothing.

§Two lanes, because a derive is an attribute

The spine exists in every build: a hand-built options value is how a programmatic deployment states what it runs, and the launch entry’s signature names the type whatever a build compiled. Only the DERIVE is conditional — an attribute cannot be added by a macro that expands to nothing — so the declaration is written twice, once inside each half of the serde gate, and the gate slurps tokens rather than parsing them, exactly as the four backend gates do.

Structs§

OptionsSpine
One ingraph root’s options spine, ready to emit.

Constants§

RESERVED_GENERATIONS_MOUNT
The mount name the GENERATIONS SEAT’s section is emitted under, which no member may take.
RESERVED_REGISTRY_MOUNT
The mount name the registry seat is emitted under, which no member may take.
RESERVED_RETIRED_MOUNT
The mount name the RETIRED LEDGER’s section is emitted under, which no member may take.

Functions§

default_options_name
<Root>Options — the name a root’s own spine takes.