pub trait HasParams: Send + 'static {
type Params: Parameters + Units + Params;
// Required methods
fn params(&self) -> &Self::Params;
fn params_mut(&mut self) -> &mut Self::Params;
}Expand description
Trait for types that hold parameters.
This trait provides a common interface for parameter access, shared between
Plugin (unprepared state) and AudioProcessor (prepared state).
Both traits require HasParams as a supertrait.
§Derive Macro
Use #[derive(HasParams)] to automatically implement this trait for structs
with a #[params] field annotation:
ⓘ
#[derive(Default, HasParams)]
pub struct GainPlugin {
#[params]
params: GainParams,
}
#[derive(HasParams)]
pub struct GainProcessor {
#[params]
params: GainParams,
}This eliminates the boilerplate of implementing params() and params_mut()
on both your Plugin and Processor types.
Required Associated Types§
Sourcetype Params: Parameters + Units + Params
type Params: Parameters + Units + Params
The parameter collection type.
Required Methods§
Sourcefn params_mut(&mut self) -> &mut Self::Params
fn params_mut(&mut self) -> &mut Self::Params
Returns a mutable reference to the parameters.