pub struct WasmRuntime { /* private fields */ }Expand description
WASM plugin runtime.
Implementations§
Source§impl WasmRuntime
impl WasmRuntime
Sourcepub fn new() -> PluginResult<Self>
pub fn new() -> PluginResult<Self>
Create a new WASM runtime.
Trait Implementations§
Source§impl Default for WasmRuntime
impl Default for WasmRuntime
Source§impl PluginRuntime for WasmRuntime
impl PluginRuntime for WasmRuntime
Source§fn file_extensions(&self) -> &'static [&'static str]
fn file_extensions(&self) -> &'static [&'static str]
Get the file extensions this runtime handles (e.g., [“.lua”]).
Source§fn init(&mut self, config: &PluginConfig) -> PluginResult<()>
fn init(&mut self, config: &PluginConfig) -> PluginResult<()>
Initialize the runtime with configuration.
Source§fn load_plugin(&mut self, id: &str, source: &Path) -> PluginResult<PluginHandle>
fn load_plugin(&mut self, id: &str, source: &Path) -> PluginResult<PluginHandle>
Load a plugin from a file path. Read more
Source§fn unload_plugin(&mut self, handle: PluginHandle) -> PluginResult<()>
fn unload_plugin(&mut self, handle: PluginHandle) -> PluginResult<()>
Unload a previously loaded plugin.
Source§fn get_metadata(&self, handle: PluginHandle) -> Option<&PluginMetadata>
fn get_metadata(&self, handle: PluginHandle) -> Option<&PluginMetadata>
Get metadata about a loaded plugin.
Source§fn has_hook(&self, handle: PluginHandle, hook_name: &str) -> bool
fn has_hook(&self, handle: PluginHandle, hook_name: &str) -> bool
Check if a plugin implements a specific hook.
Source§fn call_hook_sync(
&self,
handle: PluginHandle,
hook: &Hook,
_ctx: &HookContext,
) -> PluginResult<HookResult>
fn call_hook_sync( &self, handle: PluginHandle, hook: &Hook, _ctx: &HookContext, ) -> PluginResult<HookResult>
Call a hook on a plugin synchronously. Read more
Source§fn call_hook_async<'a>(
&'a self,
handle: PluginHandle,
hook: &'a Hook,
ctx: &'a HookContext,
) -> Pin<Box<dyn Future<Output = PluginResult<HookResult>> + Send + 'a>>
fn call_hook_async<'a>( &'a self, handle: PluginHandle, hook: &'a Hook, ctx: &'a HookContext, ) -> Pin<Box<dyn Future<Output = PluginResult<HookResult>> + Send + 'a>>
Call a hook on a plugin asynchronously. Read more
Source§fn call_method<'a>(
&'a self,
handle: PluginHandle,
method: &'a str,
args: Vec<Value>,
) -> Pin<Box<dyn Future<Output = PluginResult<Value>> + Send + 'a>>
fn call_method<'a>( &'a self, handle: PluginHandle, method: &'a str, args: Vec<Value>, ) -> Pin<Box<dyn Future<Output = PluginResult<Value>> + Send + 'a>>
Call an arbitrary method on a plugin.
Source§fn create_isolated_context(
&self,
sandbox: &SandboxConfig,
) -> PluginResult<Box<dyn IsolatedContext>>
fn create_isolated_context( &self, sandbox: &SandboxConfig, ) -> PluginResult<Box<dyn IsolatedContext>>
Create an isolated context for running async plugin code. Read more
Source§fn loaded_plugins(&self) -> Vec<PluginHandle>
fn loaded_plugins(&self) -> Vec<PluginHandle>
Get the list of loaded plugin handles.
Source§fn shutdown(&mut self) -> PluginResult<()>
fn shutdown(&mut self) -> PluginResult<()>
Shutdown the runtime and cleanup resources.
Auto Trait Implementations§
impl Freeze for WasmRuntime
impl RefUnwindSafe for WasmRuntime
impl Send for WasmRuntime
impl Sync for WasmRuntime
impl Unpin for WasmRuntime
impl UnsafeUnpin for WasmRuntime
impl UnwindSafe for WasmRuntime
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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