Skip to main content

PluginExport

Trait PluginExport 

Source
pub trait PluginExport: Plugin + Sized {
    type Params: Params;

    // Required methods
    fn create() -> Self;
    fn params(&self) -> &Self::Params;
    fn params_mut(&mut self) -> &mut Self::Params;
    fn params_arc(&self) -> Arc<Self::Params>;
}
Expand description

Unified export trait for all plugin formats.

Implement this once on your plugin type. All format wrappers (CLAP, VST3, AU, standalone) use this to construct your plugin and access its parameters.

impl PluginExport for MyPlugin {
    type Params = MyParams;
    fn create() -> Self { Self::new() }
    fn params(&self) -> &MyParams { &self.params }
    fn params_mut(&mut self) -> &mut MyParams { &mut self.params }
}

Required Associated Types§

Required Methods§

Source

fn create() -> Self

Construct a new instance of the plugin.

Source

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

Immutable access to the parameter struct.

Source

fn params_mut(&mut self) -> &mut Self::Params

Mutable access to the parameter struct.

Source

fn params_arc(&self) -> Arc<Self::Params>

Get a shared Arc reference to the parameter struct.

Used by format wrappers to pass params to GUI closures without raw pointers. The Arc is cloned (cheap ref-count bump), not the params themselves.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§