Skip to main content

PluginController

Trait PluginController 

Source
pub trait PluginController:
    'static
    + Send
    + Sized {
    const TYPE_NAME: &'static str;

    // Required method
    fn new(
        host: *const ControllerHostVTable,
        ctx: *const ControllerHostContext,
        config_json: &str,
    ) -> Self;

    // Provided methods
    fn prepare(request_json: &str) -> Result<Vec<u8>> { ... }
    fn on_start(&mut self) -> Result<()> { ... }
    fn on_stop(&mut self) -> Result<()> { ... }
    fn on_resume(&mut self) -> Result<()> { ... }
    fn on_reset(&mut self) -> Result<()> { ... }
    fn on_dispose(&mut self) -> Result<()> { ... }
    fn on_degrade(&mut self) -> Result<()> { ... }
    fn on_fault(&mut self) -> Result<()> { ... }
    fn on_time_event(&mut self, event: &TimeEvent) -> Result<()> { ... }
}
Expand description

Author-facing trait for a plug-in controller.

Controllers can define a static PluginController::prepare hook and runtime lifecycle callbacks. Every callback has a no-op default. Override only what you need.

Required Associated Constants§

Source

const TYPE_NAME: &'static str

Canonical type name. Must be unique across a Nautilus deployment.

Required Methods§

Source

fn new( host: *const ControllerHostVTable, ctx: *const ControllerHostContext, config_json: &str, ) -> Self

Constructs a fresh controller instance bound to the supplied host vtable and instance context.

Provided Methods§

Source

fn prepare(request_json: &str) -> Result<Vec<u8>>

Prepares a JSON controller request and returns a JSON response envelope.

Source

fn on_start(&mut self) -> Result<()>

Source

fn on_stop(&mut self) -> Result<()>

Source

fn on_resume(&mut self) -> Result<()>

Source

fn on_reset(&mut self) -> Result<()>

Source

fn on_dispose(&mut self) -> Result<()>

Source

fn on_degrade(&mut self) -> Result<()>

Source

fn on_fault(&mut self) -> Result<()>

Source

fn on_time_event(&mut self, event: &TimeEvent) -> Result<()>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§