Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn metadata(&self) -> PluginMetadata;
    fn on_load<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn on_unload<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn tools(&self) -> Vec<PluginToolDef> { ... }
    fn hooks(&self) -> Vec<(HookPoint, Box<dyn Hook>)> { ... }
}
Expand description

The Plugin trait that all plugins must implement.

Required Methods§

Source

fn metadata(&self) -> PluginMetadata

Get plugin metadata.

Source

fn on_load<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the plugin is loaded.

Source

fn on_unload<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the plugin is unloaded.

Provided Methods§

Source

fn tools(&self) -> Vec<PluginToolDef>

Return tool definitions provided by this plugin.

Source

fn hooks(&self) -> Vec<(HookPoint, Box<dyn Hook>)>

Return hooks this plugin wants to register.

Implementors§