Struct wasmedge_sys::Executor
source · pub struct Executor { /* private fields */ }
Expand description
Defines an execution environment for both pure WASM and compiled WASM.
Implementations§
source§impl Executor
impl Executor
sourcepub fn create(
config: Option<&Config>,
stat: Option<&mut Statistics>
) -> WasmEdgeResult<Self>
pub fn create(
config: Option<&Config>,
stat: Option<&mut Statistics>
) -> WasmEdgeResult<Self>
Creates a new executor to be associated with the given config and statistics.
Arguments
-
config
- The configuration of the new executor. -
stat
- The statistics needed by the new executor.
Error
If fail to create a executor, then an error is returned.
sourcepub fn register_import_object(
&mut self,
store: &mut Store,
import: &ImportObject
) -> WasmEdgeResult<()>
pub fn register_import_object(
&mut self,
store: &mut Store,
import: &ImportObject
) -> WasmEdgeResult<()>
Registers and instantiates a WasmEdge import object into a store.
Arguments
-
store
- The target store, into which the given import object is registered. -
import
- The WasmEdge import object to be registered.
Error
If fail to register the given import object, then an error is returned.
sourcepub fn register_named_module(
&mut self,
store: &mut Store,
module: &Module,
name: impl AsRef<str>
) -> WasmEdgeResult<Instance>
pub fn register_named_module(
&mut self,
store: &mut Store,
module: &Module,
name: impl AsRef<str>
) -> WasmEdgeResult<Instance>
Registers and instantiates a WasmEdge module into a store.
Instantiates the given WasmEdge module, including the functions, memories, tables, and globals it hosts; and then, registers the module instance into the store with the given name.
Arguments
-
store
- The target store, into which the given module is registered. -
module
- A validated module to be registered. -
name
- The exported name of the registered module.
Error
If fail to register the given module, then an error is returned.
sourcepub fn register_active_module(
&mut self,
store: &mut Store,
module: &Module
) -> WasmEdgeResult<Instance>
pub fn register_active_module(
&mut self,
store: &mut Store,
module: &Module
) -> WasmEdgeResult<Instance>
Registers and instantiates a WasmEdge module into a store as an anonymous module.
Notice that when a new module is instantiated into the store, the old instantiated module is removed; in addition, ensure that the imports the module depends are already registered into the store.
Arguments
-
store
- The store, in which the module to be instantiated is stored. -
ast_mod
- The target module to be instantiated.
Error
If fail to instantiate the given module, then an error is returned.
sourcepub fn register_plugin_instance(
&mut self,
store: &mut Store,
instance: &Instance
) -> WasmEdgeResult<()>
pub fn register_plugin_instance(
&mut self,
store: &mut Store,
instance: &Instance
) -> WasmEdgeResult<()>
sourcepub fn call_func(
&self,
func: &Function,
params: impl IntoIterator<Item = WasmValue>
) -> WasmEdgeResult<Vec<WasmValue>>
pub fn call_func(
&self,
func: &Function,
params: impl IntoIterator<Item = WasmValue>
) -> WasmEdgeResult<Vec<WasmValue>>
sourcepub async fn call_func_async(
&self,
func: &Function,
params: impl IntoIterator<Item = WasmValue> + Send
) -> WasmEdgeResult<Vec<WasmValue>>
pub async fn call_func_async(
&self,
func: &Function,
params: impl IntoIterator<Item = WasmValue> + Send
) -> WasmEdgeResult<Vec<WasmValue>>
sourcepub fn call_func_ref(
&self,
func_ref: &FuncRef,
params: impl IntoIterator<Item = WasmValue>
) -> WasmEdgeResult<Vec<WasmValue>>
pub fn call_func_ref(
&self,
func_ref: &FuncRef,
params: impl IntoIterator<Item = WasmValue>
) -> WasmEdgeResult<Vec<WasmValue>>
sourcepub async fn call_func_ref_async(
&self,
func_ref: &FuncRef,
params: impl IntoIterator<Item = WasmValue> + Send
) -> WasmEdgeResult<Vec<WasmValue>>
pub async fn call_func_ref_async(
&self,
func_ref: &FuncRef,
params: impl IntoIterator<Item = WasmValue> + Send
) -> WasmEdgeResult<Vec<WasmValue>>
sourcepub fn as_ptr(&self) -> *const WasmEdge_ExecutorContext
pub fn as_ptr(&self) -> *const WasmEdge_ExecutorContext
Provides a raw pointer to the inner Executor context.