Crate taiga_plugin_api

Crate taiga_plugin_api 

Source
Expand description

Taiga Plugin API

This crate provides the core types and traits needed to create plugins for Taiga.

§Creating a Plugin

  1. Create a new crate with crate-type = ["cdylib"]
  2. Implement the Plugin trait
  3. 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
CommandDef
Metadata about a plugin command
PluginContext
Context passed to plugins during execution Provides access to shared resources
PluginInfo
Plugin metadata for discovery
RawPlugin
Raw plugin data for FFI - contains pointer and vtable as separate values

Enums§

CommandResult
Result of a plugin command execution
PluginError
Plugin-specific errors

Traits§

AsyncPlugin
Trait for async plugin operations
Plugin
The main Plugin trait that all plugins must implement

Type Aliases§

PluginCreateFn
Plugin entry point function type
PluginDestroyFn
Plugin destruction function type
PluginResult
Result type for plugin operations