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§
Sourcefn metadata(&self) -> &PluginMetadata
fn metadata(&self) -> &PluginMetadata
Get plugin metadata
Provided Methods§
Sourcefn sandbox_config(&self) -> PluginSandboxConfig
fn sandbox_config(&self) -> PluginSandboxConfig
Get plugin sandbox configuration
Sourcefn permissions(&self) -> Vec<PluginPermission>
fn permissions(&self) -> Vec<PluginPermission>
Get plugin permissions
Sourcefn 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 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
Sourcefn 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 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
Sourcefn has_capability(&self, _capability: &str) -> bool
fn has_capability(&self, _capability: &str) -> bool
Check if plugin has specific capability
Sourcefn has_permission(&self, _permission: &PluginPermission) -> bool
fn has_permission(&self, _permission: &PluginPermission) -> bool
Check if plugin has specific permission