Plugin

Trait Plugin 

Source
pub trait Plugin:
    PluginHooks
    + Send
    + Sync {
    // Required method
    fn metadata(&self) -> &PluginMetadata;

    // Provided methods
    fn sandbox_config(&self) -> PluginSandboxConfig { ... }
    fn permissions(&self) -> Vec<PluginPermission> { ... }
    fn handle_message<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        from: &'life1 str,
        _message: &'life2 PluginMessage,
    ) -> Pin<Box<dyn Future<Output = Result<PluginMessage>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn get_state<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn has_capability(&self, _capability: &str) -> bool { ... }
    fn has_permission(&self, _permission: &PluginPermission) -> bool { ... }
}
Expand description

Plugin interface trait

Required Methods§

Source

fn metadata(&self) -> &PluginMetadata

Get plugin metadata

Provided Methods§

Source

fn sandbox_config(&self) -> PluginSandboxConfig

Get plugin sandbox configuration

Source

fn permissions(&self) -> Vec<PluginPermission>

Get plugin permissions

Source

fn handle_message<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, _message: &'life2 PluginMessage, ) -> Pin<Box<dyn Future<Output = Result<PluginMessage>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle inter-plugin message

Source

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

Get plugin state for diagnostics

Source

fn has_capability(&self, _capability: &str) -> bool

Check if plugin has specific capability

Source

fn has_permission(&self, _permission: &PluginPermission) -> bool

Check if plugin has specific permission

Implementors§