Trait sc_executor_common::wasm_runtime::WasmInstance
source · pub trait WasmInstance: Send {
// Required methods
fn call_with_allocation_stats(
&mut self,
method: InvokeMethod<'_>,
data: &[u8]
) -> (Result<Vec<u8>, Error>, Option<AllocationStats>);
fn get_global_const(&mut self, name: &str) -> Result<Option<Value>, Error>;
// Provided methods
fn call(
&mut self,
method: InvokeMethod<'_>,
data: &[u8]
) -> Result<Vec<u8>, Error> { ... }
fn call_export(
&mut self,
method: &str,
data: &[u8]
) -> Result<Vec<u8>, Error> { ... }
fn linear_memory_base_ptr(&self) -> Option<*const u8> { ... }
}
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: InvokeMethod<'_>,
data: &[u8]
) -> (Result<Vec<u8>, Error>, Option<AllocationStats>)
fn call_with_allocation_stats( &mut self, method: InvokeMethod<'_>, 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: InvokeMethod<'_>,
data: &[u8]
) -> Result<Vec<u8>, Error>
fn call( &mut self, method: InvokeMethod<'_>, 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 linear_memory_base_ptr(&self) -> Option<*const u8>
fn linear_memory_base_ptr(&self) -> Option<*const u8>
Testing Only. This function returns the base address of the linear memory.
This is meant to be the starting address of the memory mapped area for the linear memory.
This function is intended only for a specific test that measures physical memory consumption.