pub struct WasmPlugin { /* private fields */ }Expand description
WASM plugin runtime.
Implementations§
Source§impl WasmPlugin
impl WasmPlugin
Sourcepub fn load(path: &Path) -> Result<Self, PluginError>
pub fn load(path: &Path) -> Result<Self, PluginError>
Sourcepub fn load_bytes(name: &str, bytes: &[u8]) -> Result<Self, PluginError>
pub fn load_bytes(name: &str, bytes: &[u8]) -> Result<Self, PluginError>
Sourcepub fn call_export(
&mut self,
method: &str,
params: &[u8],
) -> Result<Vec<u8>, PluginError>
pub fn call_export( &mut self, method: &str, params: &[u8], ) -> Result<Vec<u8>, PluginError>
Call an exported function with JSON params and return JSON result.
§Errors
Returns error if function doesn’t exist or execution fails.
Sourcepub const fn metadata(&self) -> &WasmPluginMetadata
pub const fn metadata(&self) -> &WasmPluginMetadata
Get plugin metadata.
Trait Implementations§
Source§impl Plugin for WasmPlugin
impl Plugin for WasmPlugin
Source§fn hooks(&self) -> &[PluginHook]
fn hooks(&self) -> &[PluginHook]
Supported hooks.
Source§fn execute_hook<'life0, 'async_trait>(
&'life0 self,
hook: PluginHook,
data: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute_hook<'life0, 'async_trait>(
&'life0 self,
hook: PluginHook,
data: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute a hook.
Source§fn activate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn activate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Activate the plugin.
Source§fn deactivate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn deactivate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deactivate the plugin.
Auto Trait Implementations§
impl Freeze for WasmPlugin
impl !RefUnwindSafe for WasmPlugin
impl Send for WasmPlugin
impl Sync for WasmPlugin
impl Unpin for WasmPlugin
impl !UnwindSafe for WasmPlugin
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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