Skip to main content

HaloForgePlugin

Trait HaloForgePlugin 

Source
pub trait HaloForgePlugin: Send + Sync {
    // Required methods
    fn metadata(&self) -> PluginMetadata;
    fn on_load(
        &mut self,
        ctx: &dyn PluginContext,
        ipc: &mut dyn IpcRegistrar,
    ) -> Result<(), PluginError>;
    fn on_unload(&mut self) -> Result<(), PluginError>;

    // Provided methods
    fn on_settings_changed(
        &mut self,
        _settings: Value,
    ) -> Result<(), PluginError> { ... }
    fn execute_workflow_step(
        &mut self,
        _step_type: &str,
        _config: Value,
        _ctx: &dyn PluginContext,
    ) -> Result<Value, PluginError> { ... }
}
Expand description

Every native plugin must implement this trait.

The host loads the dynamic library, calls _haloforge_plugin_create() (declared via the declare_plugin! macro) to obtain a Box<dyn HaloForgePlugin>, then calls on_load(). On disable/shutdown, on_unload() is called.

Required Methods§

Source

fn metadata(&self) -> PluginMetadata

Return plugin metadata. Called before on_load.

Source

fn on_load( &mut self, ctx: &dyn PluginContext, ipc: &mut dyn IpcRegistrar, ) -> Result<(), PluginError>

Called after the plugin is loaded and context is ready. Register IPC commands, workflow step types, subscribe to events, create DB tables here.

Source

fn on_unload(&mut self) -> Result<(), PluginError>

Called when the plugin is being unloaded (disabled or app shutdown). Stop background tasks, release file handles, unsubscribe events.

Provided Methods§

Source

fn on_settings_changed(&mut self, _settings: Value) -> Result<(), PluginError>

Called when the user saves new settings for this plugin in Plugin Manager.

Source

fn execute_workflow_step( &mut self, _step_type: &str, _config: Value, _ctx: &dyn PluginContext, ) -> Result<Value, PluginError>

Called to execute a workflow step of a type registered by this plugin (Level 4). Return a JSON result value on success, or PluginError on failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§