pub struct PluginControllerAdapter { /* private fields */ }Expand description
Adapts a plug-in controller (vtable + handle from a cdylib) into a host-owned runtime component.
Implementations§
Source§impl PluginControllerAdapter
impl PluginControllerAdapter
Sourcepub unsafe fn new(
plugin_name: impl Into<String>,
type_name: impl Into<String>,
vtable: ValidatedControllerVTable,
host: *const ControllerHostVTable,
config_json: &str,
) -> Result<Self>
pub unsafe fn new( plugin_name: impl Into<String>, type_name: impl Into<String>, vtable: ValidatedControllerVTable, host: *const ControllerHostVTable, config_json: &str, ) -> Result<Self>
Constructs a new adapter by calling the plug-in’s create thunk.
host must point at a process-lifetime ControllerHostVTable.
config_json is forwarded verbatim to the plug-in’s
PluginController::new implementation.
§Errors
Returns an error if the plug-in’s create thunk panics or returns a
null handle.
§Safety
host must outlive the adapter and all controller callbacks.
Sourcepub fn prepare(&self, request_json: &str) -> Result<OwnedBytes>
pub fn prepare(&self, request_json: &str) -> Result<OwnedBytes>
Runs the controller’s static prepare hook.
§Errors
Returns an error if the plug-in rejects the request.
Sourcepub fn plugin_name(&self) -> &str
pub fn plugin_name(&self) -> &str
Returns the plug-in name (manifest name) the adapter wraps.
Sourcepub fn on_start(&mut self) -> Result<()>
pub fn on_start(&mut self) -> Result<()>
Dispatches on_start to the plug-in controller.
§Errors
Returns an error if the plug-in callback fails.
Sourcepub fn on_stop(&mut self) -> Result<()>
pub fn on_stop(&mut self) -> Result<()>
Dispatches on_stop to the plug-in controller.
§Errors
Returns an error if the plug-in callback fails.
Sourcepub fn on_resume(&mut self) -> Result<()>
pub fn on_resume(&mut self) -> Result<()>
Dispatches on_resume to the plug-in controller.
§Errors
Returns an error if the plug-in callback fails.
Sourcepub fn on_reset(&mut self) -> Result<()>
pub fn on_reset(&mut self) -> Result<()>
Dispatches on_reset to the plug-in controller.
§Errors
Returns an error if the plug-in callback fails.
Sourcepub fn on_dispose(&mut self) -> Result<()>
pub fn on_dispose(&mut self) -> Result<()>
Dispatches on_dispose to the plug-in controller.
§Errors
Returns an error if the plug-in callback fails.
Sourcepub fn on_degrade(&mut self) -> Result<()>
pub fn on_degrade(&mut self) -> Result<()>
Dispatches on_degrade to the plug-in controller.
§Errors
Returns an error if the plug-in callback fails.