pub struct WasmPluginInstance { /* private fields */ }Expand description
A WASM plugin instance
In production, this wraps wasmtime’s Instance. For now, we provide a functional simulation that demonstrates the API and security model.
Implementations§
Source§impl WasmPluginInstance
impl WasmPluginInstance
Sourcepub fn new(
name: &str,
_wasm_bytes: &[u8],
config: WasmInstanceConfig,
) -> KernelResult<Self>
pub fn new( name: &str, _wasm_bytes: &[u8], config: WasmInstanceConfig, ) -> KernelResult<Self>
Create a new WASM plugin instance from bytes
Sourcepub fn init(&self) -> KernelResult<()>
pub fn init(&self) -> KernelResult<()>
Initialize the plugin
Sourcepub fn call(
&self,
func_name: &str,
args: &[WasmValue],
) -> KernelResult<Vec<WasmValue>>
pub fn call( &self, func_name: &str, args: &[WasmValue], ) -> KernelResult<Vec<WasmValue>>
Call a function in the plugin
Sourcepub fn stats(&self) -> WasmPluginStats
pub fn stats(&self) -> WasmPluginStats
Get current statistics
Sourcepub fn state(&self) -> WasmPluginState
pub fn state(&self) -> WasmPluginState
Get current state
Sourcepub fn capabilities(&self) -> &WasmPluginCapabilities
pub fn capabilities(&self) -> &WasmPluginCapabilities
Get capabilities
Sourcepub fn module_hash(&self) -> &[u8; 32]
pub fn module_hash(&self) -> &[u8; 32]
Get module hash
Auto Trait Implementations§
impl !Freeze for WasmPluginInstance
impl !RefUnwindSafe for WasmPluginInstance
impl Send for WasmPluginInstance
impl Sync for WasmPluginInstance
impl Unpin for WasmPluginInstance
impl UnsafeUnpin for WasmPluginInstance
impl UnwindSafe for WasmPluginInstance
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> 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