Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;
    fn description(&self) -> &str;
    fn commands(&self) -> Vec<CommandDef>;
    fn execute(
        &self,
        command: &str,
        args: &[String],
        ctx: &mut PluginContext,
    ) -> PluginResult<CommandResult>;

    // Provided methods
    fn on_load(&self) -> PluginResult<()> { ... }
    fn on_unload(&self) -> PluginResult<()> { ... }
}
Expand description

The main Plugin trait that all plugins must implement

Required Methods§

Source

fn name(&self) -> &str

Returns the plugin’s unique name (used as CLI subcommand)

Source

fn version(&self) -> &str

Returns the plugin’s version string

Source

fn description(&self) -> &str

Returns a short description of the plugin

Source

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

Returns the list of commands this plugin provides

Source

fn execute( &self, command: &str, args: &[String], ctx: &mut PluginContext, ) -> PluginResult<CommandResult>

Execute a command with the given arguments

Provided Methods§

Source

fn on_load(&self) -> PluginResult<()>

Called when the plugin is loaded (optional initialization)

Source

fn on_unload(&self) -> PluginResult<()>

Called when the plugin is unloaded (optional cleanup)

Implementors§