pub struct WasmPluginManager { /* private fields */ }Expand description
WASM Plugin Manager
Implementations§
Source§impl WasmPluginManager
impl WasmPluginManager
Sourcepub fn new(runtime: Arc<WasmRuntime>) -> Self
pub fn new(runtime: Arc<WasmRuntime>) -> Self
Create a new plugin manager
Sourcepub fn with_runtime_config(config: RuntimeConfig) -> WasmResult<Self>
pub fn with_runtime_config(config: RuntimeConfig) -> WasmResult<Self>
Create with custom runtime config
Sourcepub fn runtime(&self) -> &Arc<WasmRuntime>
pub fn runtime(&self) -> &Arc<WasmRuntime>
Get the runtime
Sourcepub fn subscribe(&self) -> Receiver<PluginEvent>
pub fn subscribe(&self) -> Receiver<PluginEvent>
Subscribe to plugin events
Sourcepub fn set_default_config(&mut self, config: WasmPluginConfig)
pub fn set_default_config(&mut self, config: WasmPluginConfig)
Set default plugin configuration
Sourcepub async fn load_bytes(
&self,
bytes: &[u8],
config: Option<WasmPluginConfig>,
) -> WasmResult<PluginHandle>
pub async fn load_bytes( &self, bytes: &[u8], config: Option<WasmPluginConfig>, ) -> WasmResult<PluginHandle>
Load a plugin from bytes
Sourcepub async fn load_wat(
&self,
wat: &str,
config: Option<WasmPluginConfig>,
) -> WasmResult<PluginHandle>
pub async fn load_wat( &self, wat: &str, config: Option<WasmPluginConfig>, ) -> WasmResult<PluginHandle>
Load a plugin from WAT
Sourcepub async fn load_file(
&self,
path: &Path,
config: Option<WasmPluginConfig>,
) -> WasmResult<PluginHandle>
pub async fn load_file( &self, path: &Path, config: Option<WasmPluginConfig>, ) -> WasmResult<PluginHandle>
Load a plugin from file
Sourcepub async fn initialize(&self, handle: &PluginHandle) -> WasmResult<()>
pub async fn initialize(&self, handle: &PluginHandle) -> WasmResult<()>
Initialize a plugin
Sourcepub async fn unload(&self, handle: &PluginHandle) -> WasmResult<()>
pub async fn unload(&self, handle: &PluginHandle) -> WasmResult<()>
Unload a plugin
Sourcepub async fn get_plugin(
&self,
handle: &PluginHandle,
) -> WasmResult<Arc<WasmPlugin>>
pub async fn get_plugin( &self, handle: &PluginHandle, ) -> WasmResult<Arc<WasmPlugin>>
Get a plugin by handle
Sourcepub async fn call_i32(
&self,
handle: &PluginHandle,
function: &str,
args: &[Val],
) -> WasmResult<i32>
pub async fn call_i32( &self, handle: &PluginHandle, function: &str, args: &[Val], ) -> WasmResult<i32>
Call a function on a plugin
Sourcepub async fn call_void(
&self,
handle: &PluginHandle,
function: &str,
args: &[Val],
) -> WasmResult<()>
pub async fn call_void( &self, handle: &PluginHandle, function: &str, args: &[Val], ) -> WasmResult<()>
Call a void function on a plugin
Sourcepub async fn get_state(
&self,
handle: &PluginHandle,
) -> WasmResult<WasmPluginState>
pub async fn get_state( &self, handle: &PluginHandle, ) -> WasmResult<WasmPluginState>
Get plugin state
Sourcepub async fn get_metrics(
&self,
handle: &PluginHandle,
) -> WasmResult<PluginMetrics>
pub async fn get_metrics( &self, handle: &PluginHandle, ) -> WasmResult<PluginMetrics>
Get plugin metrics
Sourcepub async fn get_info(&self, handle: &PluginHandle) -> WasmResult<LoadedPlugin>
pub async fn get_info(&self, handle: &PluginHandle) -> WasmResult<LoadedPlugin>
Get plugin info
Sourcepub async fn list_plugins(&self) -> Vec<PluginHandle>
pub async fn list_plugins(&self) -> Vec<PluginHandle>
List all loaded plugins
Sourcepub async fn plugins_with_capability(
&self,
cap: &PluginCapability,
) -> Vec<PluginHandle>
pub async fn plugins_with_capability( &self, cap: &PluginCapability, ) -> Vec<PluginHandle>
Get plugins with specific capability
Sourcepub async fn unload_all(&self) -> WasmResult<()>
pub async fn unload_all(&self) -> WasmResult<()>
Unload all plugins
Auto Trait Implementations§
impl !Freeze for WasmPluginManager
impl !RefUnwindSafe for WasmPluginManager
impl Send for WasmPluginManager
impl Sync for WasmPluginManager
impl Unpin for WasmPluginManager
impl UnsafeUnpin for WasmPluginManager
impl !UnwindSafe for WasmPluginManager
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