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<PluginControllerAdapter, Error>
pub unsafe fn new( plugin_name: impl Into<String>, type_name: impl Into<String>, vtable: ValidatedControllerVTable, host: *const ControllerHostVTable, config_json: &str, ) -> Result<PluginControllerAdapter, Error>
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, Error>
pub fn prepare(&self, request_json: &str) -> Result<OwnedBytes, Error>
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<(), Error>
pub fn on_start(&mut self) -> Result<(), Error>
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<(), Error>
pub fn on_stop(&mut self) -> Result<(), Error>
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<(), Error>
pub fn on_resume(&mut self) -> Result<(), Error>
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<(), Error>
pub fn on_reset(&mut self) -> Result<(), Error>
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<(), Error>
pub fn on_dispose(&mut self) -> Result<(), Error>
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<(), Error>
pub fn on_degrade(&mut self) -> Result<(), Error>
Dispatches on_degrade to the plug-in controller.
§Errors
Returns an error if the plug-in callback fails.
Trait Implementations§
Source§impl Debug for PluginControllerAdapter
impl Debug for PluginControllerAdapter
Source§impl Drop for PluginControllerAdapter
impl Drop for PluginControllerAdapter
impl Send for PluginControllerAdapter
Auto Trait Implementations§
impl !Sync for PluginControllerAdapter
impl Freeze for PluginControllerAdapter
impl RefUnwindSafe for PluginControllerAdapter
impl Unpin for PluginControllerAdapter
impl UnsafeUnpin for PluginControllerAdapter
impl UnwindSafe for PluginControllerAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more