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§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Returns a short description of the plugin
Sourcefn commands(&self) -> Vec<CommandDef>
fn commands(&self) -> Vec<CommandDef>
Returns the list of commands this plugin provides
Sourcefn execute(
&self,
command: &str,
args: &[String],
ctx: &mut PluginContext,
) -> PluginResult<CommandResult>
fn execute( &self, command: &str, args: &[String], ctx: &mut PluginContext, ) -> PluginResult<CommandResult>
Execute a command with the given arguments
Provided Methods§
Sourcefn on_load(&self) -> PluginResult<()>
fn on_load(&self) -> PluginResult<()>
Called when the plugin is loaded (optional initialization)
Sourcefn on_unload(&self) -> PluginResult<()>
fn on_unload(&self) -> PluginResult<()>
Called when the plugin is unloaded (optional cleanup)