Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Sized {
    type Config: DeserializeOwned + JsonSchema;
    type SystemConfig: DeserializeOwned + JsonSchema;

    // Required methods
    fn manifest() -> Manifest;
    fn start(
        host: Host,
        setup: Setup<Self::Config, Self::SystemConfig>,
    ) -> Result<Self, String>;

    // Provided methods
    fn call_start(&mut self, _call: CallInfo) { ... }
    fn call_end(&mut self, _call: CallInfo) { ... }
    fn call_concluded(&mut self, _call: ConcludedCall) { ... }
    fn unit(&mut self, _event: UnitEvent) { ... }
    fn audio(&mut self, _chunk: AudioChunk) { ... }
    fn status(&mut self, _status: Status) { ... }
    fn shutdown(&mut self, _grace: Duration) { ... }
}
Expand description

A plugin. Every method runs on the one thread that reads the recorder’s messages, one message at a time: return quickly, and hand slow work (network, disk, other processes) to a thread of your own.

Required Associated Types§

Source

type Config: DeserializeOwned + JsonSchema

The plugin’s settings. #[serde(default)] on the struct lets a user leave any of them empty. The settings form is drawn from its schema (see crate::schema). NoConfig for none.

Source

type SystemConfig: DeserializeOwned + JsonSchema

Settings for each system, when the plugin needs some (an API key per system, say). NoConfig for none.

Required Methods§

Source

fn manifest() -> Manifest

Who the plugin is and what it subscribes to — start from crate::manifest!. config and system_config are filled in from the types above.

Source

fn start( host: Host, setup: Setup<Self::Config, Self::SystemConfig>, ) -> Result<Self, String>

Start with the user’s settings. An Err is shown to the user, and the plugin isn’t started again until recording next starts.

Provided Methods§

Source

fn call_start(&mut self, _call: CallInfo)

Source

fn call_end(&mut self, _call: CallInfo)

Source

fn call_concluded(&mut self, _call: ConcludedCall)

Source

fn unit(&mut self, _event: UnitEvent)

Source

fn audio(&mut self, _chunk: AudioChunk)

Source

fn status(&mut self, _status: Status)

Source

fn shutdown(&mut self, _grace: Duration)

The recorder is stopping (or the plugin’s stdin closed): finish or save what’s in flight within grace — the process exits when this returns.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§