pub struct WasmRuntime { /* private fields */ }Expand description
WASM Runtime
Implementations§
Source§impl WasmRuntime
impl WasmRuntime
Sourcepub fn new(config: RuntimeConfig) -> WasmResult<Self>
pub fn new(config: RuntimeConfig) -> WasmResult<Self>
Create a new WASM runtime
Sourcepub fn default_runtime() -> WasmResult<Self>
pub fn default_runtime() -> WasmResult<Self>
Create with default configuration
Sourcepub fn config(&self) -> &RuntimeConfig
pub fn config(&self) -> &RuntimeConfig
Get runtime configuration
Sourcepub async fn compile(
&self,
name: &str,
bytes: &[u8],
) -> WasmResult<Arc<CompiledModule>>
pub async fn compile( &self, name: &str, bytes: &[u8], ) -> WasmResult<Arc<CompiledModule>>
Compile a WASM module from bytes
Sourcepub async fn compile_wat(
&self,
name: &str,
wat: &str,
) -> WasmResult<Arc<CompiledModule>>
pub async fn compile_wat( &self, name: &str, wat: &str, ) -> WasmResult<Arc<CompiledModule>>
Compile from WAT format
Sourcepub async fn compile_file(
&self,
name: &str,
path: &Path,
) -> WasmResult<Arc<CompiledModule>>
pub async fn compile_file( &self, name: &str, path: &Path, ) -> WasmResult<Arc<CompiledModule>>
Compile from file
Sourcepub async fn create_plugin(
&self,
compiled: &CompiledModule,
config: WasmPluginConfig,
) -> WasmResult<WasmPlugin>
pub async fn create_plugin( &self, compiled: &CompiledModule, config: WasmPluginConfig, ) -> WasmResult<WasmPlugin>
Create a plugin from compiled module
Sourcepub async fn create_plugin_from_bytes(
&self,
bytes: &[u8],
config: WasmPluginConfig,
) -> WasmResult<WasmPlugin>
pub async fn create_plugin_from_bytes( &self, bytes: &[u8], config: WasmPluginConfig, ) -> WasmResult<WasmPlugin>
Create a plugin directly from bytes
Sourcepub async fn create_plugin_from_wat(
&self,
wat: &str,
config: WasmPluginConfig,
) -> WasmResult<WasmPlugin>
pub async fn create_plugin_from_wat( &self, wat: &str, config: WasmPluginConfig, ) -> WasmResult<WasmPlugin>
Create a plugin directly from WAT
Sourcepub async fn stats(&self) -> RuntimeStats
pub async fn stats(&self) -> RuntimeStats
Get runtime statistics
Sourcepub async fn cache_stats(&self) -> CacheStats
pub async fn cache_stats(&self) -> CacheStats
Get cache statistics
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the module cache
Sourcepub fn uptime_secs(&self) -> u64
pub fn uptime_secs(&self) -> u64
Get uptime in seconds
Sourcepub fn increment_epoch(&self)
pub fn increment_epoch(&self)
Increment epoch for epoch-based interruption
Sourcepub fn start_epoch_ticker(&self) -> JoinHandle<()>
pub fn start_epoch_ticker(&self) -> JoinHandle<()>
Start epoch ticker for timeout support
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> 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