Trait xplm::plugin::Plugin

source ·
pub trait Plugin: Sized {
    type Error: Error;

    // Required methods
    fn start() -> Result<Self, Self::Error>;
    fn info(&self) -> PluginInfo;

    // Provided methods
    fn enable(&mut self) -> Result<(), Self::Error> { ... }
    fn disable(&mut self) { ... }
}
Expand description

The trait that all plugins should implement

Required Associated Types§

source

type Error: Error

The error type that a plugin may encounter when starting up or enabling

Required Methods§

source

fn start() -> Result<Self, Self::Error>

Called when X-Plane loads this plugin

On success, returns a plugin object

source

fn info(&self) -> PluginInfo

Returns information on this plugin

Provided Methods§

source

fn enable(&mut self) -> Result<(), Self::Error>

Called when the plugin is enabled

If this function returns an Err, the plugin will remain disabled.

The default implementation returns Ok(()).

source

fn disable(&mut self)

Called when the plugin is disabled

The default implementation does nothing.

Object Safety§

This trait is not object safe.

Implementors§