Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn hooks(&self) -> &[PluginHook];
    fn execute_hook<'life0, 'async_trait>(
        &'life0 self,
        hook: PluginHook,
        data: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn activate<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn deactivate<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Plugin trait.

Required Methods§

Source

fn id(&self) -> &str

Plugin ID.

Source

fn name(&self) -> &str

Plugin name.

Source

fn version(&self) -> &str

Plugin version.

Source

fn hooks(&self) -> &[PluginHook]

Supported hooks.

Source

fn execute_hook<'life0, 'async_trait>( &'life0 self, hook: PluginHook, data: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute a hook.

Source

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

Activate the plugin.

Source

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

Deactivate the plugin.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Plugin for NativePlugin

Source§

impl Plugin for TsPluginBridge

Implement the Plugin trait so the bridge can be registered.

Source§

impl Plugin for WasmPlugin