Struct wasmedge_sdk::Instance
source · pub struct Instance { /* private fields */ }
Expand description
Represents an instantiated module.
An Instance represents an instantiated module. In the instantiation process, A module instance is created based on a compiled module. From a [module instance] the exported host function, table, memory, and global instances can be fetched.
Implementations§
source§impl Instance
impl Instance
sourcepub fn name(&self) -> Option<String>
pub fn name(&self) -> Option<String>
Returns the name of this exported module instance.
If this module instance is an active instance, return None.
sourcepub fn func_count(&self) -> usize
pub fn func_count(&self) -> usize
Returns the count of the exported function instances in this module instance.
sourcepub fn func_names(&self) -> Option<Vec<String>>
pub fn func_names(&self) -> Option<Vec<String>>
Returns the names of the exported function instances in this module instance.
sourcepub fn func(&self, name: impl AsRef<str>) -> WasmEdgeResult<Func>
pub fn func(&self, name: impl AsRef<str>) -> WasmEdgeResult<Func>
Returns the exported function instance in this module instance by the given function name.
Argument
name
- the name of the target exported function instance.
sourcepub fn global_count(&self) -> usize
pub fn global_count(&self) -> usize
Returns the count of the exported global instances in this module instance.
sourcepub fn global_names(&self) -> Option<Vec<String>>
pub fn global_names(&self) -> Option<Vec<String>>
Returns the names of the exported global instances in this module instance.
sourcepub fn global(&self, name: impl AsRef<str>) -> WasmEdgeResult<Global>
pub fn global(&self, name: impl AsRef<str>) -> WasmEdgeResult<Global>
Returns the exported global instance in this module instance by the given global name.
Argument
name
- the name of the target exported global instance.
sourcepub fn memory_count(&self) -> usize
pub fn memory_count(&self) -> usize
Returns the count of the exported memory instances in this module instance.
sourcepub fn memory_names(&self) -> Option<Vec<String>>
pub fn memory_names(&self) -> Option<Vec<String>>
Returns the names of the exported memory instances in this module instance.
sourcepub fn memory(&self, name: impl AsRef<str>) -> WasmEdgeResult<Memory>
pub fn memory(&self, name: impl AsRef<str>) -> WasmEdgeResult<Memory>
Returns the exported memory instance in this module instance by the given memory name.
Argument
name
- the name of the target exported memory instance.
sourcepub fn table_count(&self) -> usize
pub fn table_count(&self) -> usize
Returns the count of the exported table instances in this module instance.
sourcepub fn table_names(&self) -> Option<Vec<String>>
pub fn table_names(&self) -> Option<Vec<String>>
Returns the names of the exported table instances in this module instance.
sourcepub fn table(&self, name: impl AsRef<str>) -> WasmEdgeResult<Table>
pub fn table(&self, name: impl AsRef<str>) -> WasmEdgeResult<Table>
Returns the exported table instance in this module instance by the given table name.
Argument
name
- the name of the target exported table instance.