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§
Required Methods§
Sourcefn new(
host: *const ControllerHostVTable,
ctx: *const ControllerHostContext,
config_json: &str,
) -> Self
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§
Sourcefn prepare(request_json: &str) -> Result<Vec<u8>>
fn prepare(request_json: &str) -> Result<Vec<u8>>
Prepares a JSON controller request and returns a JSON response envelope.
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<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".