Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn info(&self) -> &PluginInfo;
    fn initialize(&mut self, api: &dyn PluginAPIInterface) -> Result<(), String>;
    fn invoke_command(
        &self,
        command: &str,
        params: Value,
        api: &dyn PluginAPIInterface,
    ) -> Result<Value, String>;
    fn shutdown(&self) -> Result<(), String>;

    // Provided methods
    fn get_schema_extensions(&self) -> Vec<SchemaExtension> { ... }
    fn get_frontend_bundle(&self) -> Option<Vec<u8>> { ... }
}
Expand description

Plugin trait that all plugins must implement

Required Methods§

Source

fn info(&self) -> &PluginInfo

Get plugin metadata

Source

fn initialize(&mut self, api: &dyn PluginAPIInterface) -> Result<(), String>

Initialize the plugin

Source

fn invoke_command( &self, command: &str, params: Value, api: &dyn PluginAPIInterface, ) -> Result<Value, String>

Invoke a command on the plugin The api parameter provides database access and other core functionality

Source

fn shutdown(&self) -> Result<(), String>

Shutdown the plugin

Provided Methods§

Source

fn get_schema_extensions(&self) -> Vec<SchemaExtension>

Get schema extensions that this plugin requires This allows plugins to declare their own database tables and schema changes

Source

fn get_frontend_bundle(&self) -> Option<Vec<u8>>

Get frontend bundle bytes (if plugin provides UI)

Implementors§