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§
Sourcetype Config: DeserializeOwned + JsonSchema
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.
Sourcetype SystemConfig: DeserializeOwned + JsonSchema
type SystemConfig: DeserializeOwned + JsonSchema
Settings for each system, when the plugin needs some (an API key per
system, say). NoConfig for none.
Required Methods§
Sourcefn manifest() -> Manifest
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.
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)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".