Skip to main content

ParamSnapshot

Struct ParamSnapshot 

Source
pub struct ParamSnapshot<'a> {
    pub get_param: &'a dyn Fn(u32) -> f32,
    pub get_param_plain: &'a dyn Fn(u32) -> f32,
    pub format_param: &'a dyn Fn(u32) -> String,
    pub get_meter: &'a dyn Fn(u32) -> f32,
    pub get_options: &'a dyn Fn(u32) -> Vec<String>,
    pub default_normalized: &'a dyn Fn(u32) -> f32,
    pub next_discrete_normalized: &'a dyn Fn(u32) -> f32,
    pub param_name: &'a dyn Fn(u32) -> String,
    pub widget_type: &'a dyn Fn(u32) -> WidgetType,
}
Expand description

Immutable view of one frame’s worth of parameter state.

Each field is a borrowed closure, so the snapshot itself is cheap to construct - no copying of values up front. Closures are read on demand as widgets/dispatch need them.

Fields§

§get_param: &'a dyn Fn(u32) -> f32

Read normalized value (0.0–1.0).

§get_param_plain: &'a dyn Fn(u32) -> f32

Read plain (unit-scaled) value.

§format_param: &'a dyn Fn(u32) -> String

Format the current plain value as a display string.

§get_meter: &'a dyn Fn(u32) -> f32

Read a meter value (0.0–1.0).

§get_options: &'a dyn Fn(u32) -> Vec<String>

Enumerate option display strings for a discrete/enum parameter. Returns empty if the parameter is continuous or not dropdown-shaped.

§default_normalized: &'a dyn Fn(u32) -> f32

Default normalized value, used for reset-on-double-click.

§next_discrete_normalized: &'a dyn Fn(u32) -> f32

Compute the next normalized value after a click-to-cycle selector advance. Wraps around at the end of the range.

§param_name: &'a dyn Fn(u32) -> String

Parameter display name. Used as a fallback label when a layout entry did not supply its own (e.g. XY-pad axis names).

§widget_type: &'a dyn Fn(u32) -> WidgetType

Auto-detected widget type from the parameter’s range. widgets::draw uses this when the layout entry did not specify an explicit widget kind.

Auto Trait Implementations§

§

impl<'a> Freeze for ParamSnapshot<'a>

§

impl<'a> !RefUnwindSafe for ParamSnapshot<'a>

§

impl<'a> !Send for ParamSnapshot<'a>

§

impl<'a> !Sync for ParamSnapshot<'a>

§

impl<'a> Unpin for ParamSnapshot<'a>

§

impl<'a> UnsafeUnpin for ParamSnapshot<'a>

§

impl<'a> !UnwindSafe for ParamSnapshot<'a>

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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, 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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>