pub struct WASMRuntime {
engine: Engine,
config: WASMConfig,
memory_manager: Arc<RwLock<MemoryManagerImpl>>,
instances: Arc<RwLock<Vec<String>>>,
}Expand description
WASM Runtime - manages WASMtime engine and stores
Fields§
§engine: Engine§config: WASMConfig§memory_manager: Arc<RwLock<MemoryManagerImpl>>§instances: Arc<RwLock<Vec<String>>>Implementations§
Source§impl WASMRuntime
impl WASMRuntime
Sourcepub async fn new(config: WASMConfig) -> Result<Self>
pub async fn new(config: WASMConfig) -> Result<Self>
Create a new WASM runtime with the given configuration
Sourcepub fn config(&self) -> &WASMConfig
pub fn config(&self) -> &WASMConfig
Get the runtime configuration
Sourcepub fn memory_manager(&self) -> Arc<RwLock<MemoryManagerImpl>>
pub fn memory_manager(&self) -> Arc<RwLock<MemoryManagerImpl>>
Get the memory manager
Sourcepub fn create_store(&self) -> Result<Store<StoreLimits>>
pub fn create_store(&self) -> Result<Store<StoreLimits>>
Create a new WASM store with limits
Sourcepub fn create_linker<T>(&self, async_support: bool) -> Result<Linker<T>>where
T: Send,
pub fn create_linker<T>(&self, async_support: bool) -> Result<Linker<T>>where
T: Send,
Create a linker for the runtime
Sourcepub fn compile_module(&self, wasm_bytes: &[u8]) -> Result<Module>
pub fn compile_module(&self, wasm_bytes: &[u8]) -> Result<Module>
Compile a WASM module from bytes
Sourcepub fn validate_module(&self, wasm_bytes: &[u8]) -> Result<bool>
pub fn validate_module(&self, wasm_bytes: &[u8]) -> Result<bool>
Validate a WASM module without compiling
Sourcepub async fn register_instance(&self, instance_id: String) -> Result<()>
pub async fn register_instance(&self, instance_id: String) -> Result<()>
Register an instance
Sourcepub async fn unregister_instance(&self, instance_id: &str) -> Result<bool>
pub async fn unregister_instance(&self, instance_id: &str) -> Result<bool>
Unregister an instance
Sourcepub async fn instance_count(&self) -> usize
pub async fn instance_count(&self) -> usize
Get the number of active instances
Trait Implementations§
Source§impl Clone for WASMRuntime
impl Clone for WASMRuntime
Source§fn clone(&self) -> WASMRuntime
fn clone(&self) -> WASMRuntime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WASMRuntime
impl !RefUnwindSafe for WASMRuntime
impl Send for WASMRuntime
impl Sync for WASMRuntime
impl Unpin 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request