Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Debug {
    // Required methods
    fn metadata(&self) -> PluginMetadata;
    fn on_load(&mut self) -> Result<(), String>;
    fn on_unload(&mut self) -> Result<(), String>;
    fn extensions(&self) -> Vec<Extension>;
    fn handle_action(
        &mut self,
        action: &str,
        params: &Value,
    ) -> Result<Value, String>;
}
Expand description

Trait that all plugins must implement.

Required Methods§

Source

fn metadata(&self) -> PluginMetadata

Return metadata for this plugin.

Source

fn on_load(&mut self) -> Result<(), String>

Called when the plugin is loaded.

Source

fn on_unload(&mut self) -> Result<(), String>

Called when the plugin is unloaded.

Source

fn extensions(&self) -> Vec<Extension>

Return the extensions this plugin provides.

Source

fn handle_action( &mut self, action: &str, params: &Value, ) -> Result<Value, String>

Handle a named action dispatched to this plugin.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§