Skip to main content

ParameterizedAlgorithm

Trait ParameterizedAlgorithm 

Source
pub trait ParameterizedAlgorithm<T: Transcendental>: Algorithm<T> {
    type Params: Clone + Send + Sync;

    // Required methods
    fn params(&self) -> &Self::Params;
    fn set_params(&mut self, params: Self::Params);

    // Provided method
    fn set_parameter(
        &mut self,
        _name: &str,
        _value: ParamValue,
    ) -> Result<(), &'static str> { ... }
}
Expand description

An Algorithm with typed, settable parameters.

Extends the base Algorithm trait with the ability to get and set a typed parameter struct (Params) and to update individual parameters by name (for automation integration).

§Type parameter

Params — the concrete parameter type. Must be Clone + Send + Sync. Different algorithm families use different structs (e.g. FilterParams for DSP filters, StringParams for string models).

Required Associated Types§

Source

type Params: Clone + Send + Sync

The concrete parameter type for this algorithm.

Required Methods§

Source

fn params(&self) -> &Self::Params

Get a reference to the current parameters.

Source

fn set_params(&mut self, params: Self::Params)

Replace all parameters atomically.

The implementation should recompute any derived coefficients.

Provided Methods§

Source

fn set_parameter( &mut self, _name: &str, _value: ParamValue, ) -> Result<(), &'static str>

Set a single parameter by name (for automation / scripting).

Default: returns an error for any unrecognised name.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§