pub struct ParamSpec {
pub name: &'static str,
pub default: f32,
pub range: Option<[f32; 2]>,
pub doc: &'static str,
pub kind: ParamKind,
}Expand description
What one named parameter is, as the engine declares it (ADR-0170).
A scene and an engine stage each declare their parameters as a &[ParamSpec]
rather than as a bare &[&str]. Three things read the same declaration: the
load-time check that a preset binding names something real, the constant a
scene applies at reset, and the generated reference table in
presets/README.md. Before this they were three copies, and only the names
were held together.
The doc line is the definition; the roster’s essay is the discussion. One sentence, saying what the parameter does — not restating its name.
Fields§
§name: &'static strThe name a preset binds, exactly as it is spelled in a .toml.
default: f32The value reset_params applies, and the one the reference prints.
Read back out with default_of, which resolves at compile time — so
the scene’s DEFAULT_* constants and this field are one number, not two.
range: Option<[f32; 2]>The range that reads, for the table.
Not a clamp and not a validation bound: it is what an author can expect
to see a difference across. None where the parameter is unbounded or
world-space, in which case the frame is the bound — inventing a number
there would be a claim nothing holds.
doc: &'static strOne sentence: what the parameter does.
kind: ParamKindWhether the value carries an integer meaning (ADR-0180 rule 2).
Read back out with kind_of, and enforced by
declared_params_match_set_param in core/tests/preset.rs, which
compares this against a hand-kept roster — a field nothing checks is a
field that drifts.