Skip to main content

Module plugin

Module plugin 

Source
Expand description

Plugin trait — the shared contract for pulse-null plugins.

Plugins are constructed via async factory functions, not through the trait. By the time a Plugin exists, it is fully initialized and ready for start().

§Factory Pattern

Each plugin crate exports a factory function:

ⓘ
pub async fn create(
    config: &serde_json::Value,
    ctx: &PluginContext,
) -> Result<Box<dyn Plugin>, Box<dyn Error + Send + Sync>>

This avoids two-phase initialization — the plugin is either fully constructed or the factory returns an error.

§Object Safety

The trait is object-safe and designed for Box<dyn Plugin>. Async methods use Pin<Box<dyn Future>> instead of async_trait.

Structs§

PluginContext
Context passed to plugin factories during construction.

Enums§

PluginRole
Declares what role a plugin fills in the system.

Traits§

Plugin
The core plugin contract.

Type Aliases§

PluginResult
Async result type for plugin lifecycle operations.