Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: 'static {
    // Required methods
    fn id(&self) -> PluginId;
    fn connect(&mut self, ctx: &mut Ctx<'_>) -> Result<(), PluginError>;

    // Provided methods
    fn title(&self) -> String { ... }
    fn requires(&self) -> Vec<PluginId> { ... }
    fn priority(&self) -> i32 { ... }
    fn enabled(&self, _ctx: &Ctx<'_>) -> bool { ... }
    fn disconnect(&mut self, _ctx: &mut Ctx<'_>) { ... }
}
Expand description

An application feature.

Required Methods§

Source

fn id(&self) -> PluginId

Source

fn connect(&mut self, ctx: &mut Ctx<'_>) -> Result<(), PluginError>

Registers what it brings.

Provided Methods§

Source

fn title(&self) -> String

A human title (settings sections, the debug bridge); the id by default.

Source

fn requires(&self) -> Vec<PluginId>

The plugins it needs connected first.

Source

fn priority(&self) -> i32

Among plugins ready at the same time, higher connects first.

Source

fn enabled(&self, _ctx: &Ctx<'_>) -> bool

Whether to connect it (a setting may switch it off).

Source

fn disconnect(&mut self, _ctx: &mut Ctx<'_>)

Releases what it holds outside the framework; its registrations are removed by the framework.

Implementors§