Expand description
Taiga Plugin API
This crate provides the core types and traits needed to create plugins for Taiga.
§Creating a Plugin
- Create a new crate with
crate-type = ["cdylib"] - Implement the
Plugintrait - Export the plugin using
export_plugin!macro
§Example
ⓘ
use taiga_plugin_api::{Plugin, PluginContext, CommandDef, CommandResult, export_plugin};
pub struct MyPlugin;
impl Plugin for MyPlugin {
fn name(&self) -> &str { "my-plugin" }
fn version(&self) -> &str { "0.1.0" }
fn description(&self) -> &str { "My awesome plugin" }
fn commands(&self) -> Vec<CommandDef> {
vec![CommandDef::new("greet", "Says hello")]
}
fn execute(&self, cmd: &str, args: &[String], _ctx: &mut PluginContext) -> PluginResult<CommandResult> {
match cmd {
"greet" => Ok(CommandResult::Success(Some("Hello!".into()))),
_ => Ok(CommandResult::Error(format!("Unknown command: {}", cmd))),
}
}
}
export_plugin!(MyPlugin);Modules§
- daemon
- Daemon infrastructure for plugin development
Macros§
- export_
plugin - Macro to export a plugin from a cdylib crate
Structs§
- ArgDef
- Definition of a command argument
- Command
Def - Metadata about a plugin command
- Plugin
Context - Context passed to plugins during execution Provides access to shared resources
- Plugin
Info - Plugin metadata for discovery
- RawPlugin
- Raw plugin data for FFI - contains pointer and vtable as separate values
Enums§
- Command
Result - Result of a plugin command execution
- Plugin
Error - Plugin-specific errors
Traits§
- Async
Plugin - Trait for async plugin operations
- Plugin
- The main Plugin trait that all plugins must implement
Type Aliases§
- Plugin
Create Fn - Plugin entry point function type
- Plugin
Destroy Fn - Plugin destruction function type
- Plugin
Result - Result type for plugin operations