Skip to main content

PluginBinding

Trait PluginBinding 

Source
pub trait PluginBinding:
    Send
    + Sync
    + 'static {
    type SessionConfig: Clone + Send + Sync + 'static;
    type Input: Clone + Send + Sync + 'static;

    const ID: &'static str;

    // Required method
    fn factory(config: &Self::SessionConfig) -> Arc<dyn PluginFactory> ;

    // Provided method
    fn requires_turn_input(_config: &Self::SessionConfig) -> bool { ... }
}
Expand description

Typed app-facing activation for an ordinary Lash plugin.

A binding is not a second plugin implementation model. It gives embed hosts typed session configuration and typed per-turn input while still building a normal PluginFactory whose session plugin registers capabilities through lash_core::PluginRegistrar.

Plugin crates should expose a small domain extension trait over TurnBuilder for their turn input instead of asking app route code to call TurnBuilder::with_plugin_input directly:

trait ToneTurnExt {
    fn with_tone(self, tone: Tone) -> Self;
}

impl ToneTurnExt for lash::TurnBuilder {
    fn with_tone(self, tone: Tone) -> Self {
        self.with_plugin_input::<TonePlugin>(ToneInput { tone })
    }
}

Required Associated Constants§

Source

const ID: &'static str

Required Associated Types§

Source

type SessionConfig: Clone + Send + Sync + 'static

Source

type Input: Clone + Send + Sync + 'static

Required Methods§

Source

fn factory(config: &Self::SessionConfig) -> Arc<dyn PluginFactory>

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§