Struct wasmedge_sdk::Store
source · pub struct Store { /* private fields */ }
Expand description
Implementations§
source§impl Store
impl Store
sourcepub fn new() -> WasmEdgeResult<Self>
pub fn new() -> WasmEdgeResult<Self>
sourcepub fn register_import_module(
&mut self,
executor: &mut Executor,
import: &ImportObject
) -> WasmEdgeResult<()>
pub fn register_import_module(
&mut self,
executor: &mut Executor,
import: &ImportObject
) -> WasmEdgeResult<()>
Registers and instantiates a WasmEdge import object into this store.
Arguments
-
executor
- The executor that runs the host functions in this store. -
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,
executor: &mut Executor,
mod_name: impl AsRef<str>,
module: &Module
) -> WasmEdgeResult<Instance>
pub fn register_named_module(
&mut self,
executor: &mut Executor,
mod_name: impl AsRef<str>,
module: &Module
) -> WasmEdgeResult<Instance>
Registers and instantiates a WasmEdge compiled module into this store as a named module instance, and returns the module instance.
Instantiates the given WasmEdge compiled module, including the functions, memories, tables, and globals it hosts; and then, registers the module instance into the store with the given name.
Arguments
-
executor
- The executor that runs the host functions in this store. -
mod_name
- The exported name of the registered module. -
module
- The validated module to be registered.
Error
If fail to register the given module, then an error is returned.
sourcepub fn register_active_module(
&mut self,
executor: &mut Executor,
module: &Module
) -> WasmEdgeResult<Instance>
pub fn register_active_module(
&mut self,
executor: &mut Executor,
module: &Module
) -> WasmEdgeResult<Instance>
Registers and instantiates a WasmEdge compiled module into this store as an anonymous active module instance, and returns the module instance.
Arguments
-
executor
- The executor that runs the host functions in this store. -
module
- The validated module to be registered.
Error
If fail to register the given module, then an error is returned.
sourcepub fn named_instance_count(&self) -> u32
pub fn named_instance_count(&self) -> u32
Returns the number of the named module instances in this store.
sourcepub fn instance_names(&self) -> Vec<String>
pub fn instance_names(&self) -> Vec<String>
Returns the names of all registered named module instances.
sourcepub fn named_instance(
&mut self,
name: impl AsRef<str>
) -> WasmEdgeResult<Instance>
pub fn named_instance(
&mut self,
name: impl AsRef<str>
) -> WasmEdgeResult<Instance>
Returns the named module instance with the given name.
Argument
name
- The name of the target module instance to be returned.