Skip to main content

ParamSpec

Struct ParamSpec 

Source
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 str

The name a preset binds, exactly as it is spelled in a .toml.

§default: f32

The 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 str

One sentence: what the parameter does.

§kind: ParamKind

Whether 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.

Trait Implementations§

Source§

impl Clone for ParamSpec

Source§

fn clone(&self) -> ParamSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParamSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ParamSpec

Source§

fn eq(&self, other: &ParamSpec) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ParamSpec

Source§

impl StructuralPartialEq for ParamSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,