pub trait WasmInstance: Send {
// Required method
fn call_with_allocation_stats(
&mut self,
method: &str,
data: &[u8],
) -> (Result<Vec<u8>, Error>, Option<AllocationStats>);
// Provided methods
fn call(&mut self, method: &str, data: &[u8]) -> Result<Vec<u8>, Error> { ... }
fn call_export(
&mut self,
method: &str,
data: &[u8],
) -> Result<Vec<u8>, Error> { ... }
fn set_heap_alloc_strategy(
&mut self,
_heap_alloc_strategy: HeapAllocStrategy,
) { ... }
}Expand description
A trait that defines an abstract wasm module instance.
This can be implemented by an execution engine.
Required Methods§
Sourcefn call_with_allocation_stats(
&mut self,
method: &str,
data: &[u8],
) -> (Result<Vec<u8>, Error>, Option<AllocationStats>)
fn call_with_allocation_stats( &mut self, method: &str, data: &[u8], ) -> (Result<Vec<u8>, Error>, Option<AllocationStats>)
Call a method on this WASM instance.
Before execution, instance is reset.
Returns the encoded result on success.
Provided Methods§
Sourcefn call(&mut self, method: &str, data: &[u8]) -> Result<Vec<u8>, Error>
fn call(&mut self, method: &str, data: &[u8]) -> Result<Vec<u8>, Error>
Call a method on this WASM instance.
Before execution, instance is reset.
Returns the encoded result on success.
Sourcefn call_export(&mut self, method: &str, data: &[u8]) -> Result<Vec<u8>, Error>
fn call_export(&mut self, method: &str, data: &[u8]) -> Result<Vec<u8>, Error>
Call an exported method on this WASM instance.
Before execution, instance is reset.
Returns the encoded result on success.
Sourcefn set_heap_alloc_strategy(&mut self, _heap_alloc_strategy: HeapAllocStrategy)
fn set_heap_alloc_strategy(&mut self, _heap_alloc_strategy: HeapAllocStrategy)
Update the heap allocation strategy for subsequent calls.
This is used when an instance is reused from a pool but the caller needs a different memory limit than what the instance was originally created with.