Trait Plugin

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn description(&self) -> &str;
    fn initialize(&mut self, config: &PluginConfig) -> Result<()>;
    fn execute(&self, command: &str, args: &[String]) -> Result<()>;
    fn commands(&self) -> Vec<PluginCommand>;
    fn cleanup(&mut self) -> Result<()>;
}
Expand description

Trait that all plugins must implement

Required Methods§

Source

fn name(&self) -> &str

Returns the name of the plugin

Source

fn version(&self) -> &str

Returns the version of the plugin

Source

fn description(&self) -> &str

Returns a description of the plugin

Source

fn initialize(&mut self, config: &PluginConfig) -> Result<()>

Initializes the plugin with the given configuration

Source

fn execute(&self, command: &str, args: &[String]) -> Result<()>

Executes a command provided by the plugin

Source

fn commands(&self) -> Vec<PluginCommand>

Returns a list of commands provided by the plugin

Source

fn cleanup(&mut self) -> Result<()>

Cleans up any resources used by the plugin

Implementors§