Struct wasmedge_sys::Instance
source · pub struct Instance { /* private fields */ }
Expand description
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 module instance, then None is returned.
sourcepub fn get_func(&self, name: impl AsRef<str>) -> WasmEdgeResult<Function>
pub fn get_func(&self, name: impl AsRef<str>) -> WasmEdgeResult<Function>
Returns the exported function instance by name.
Argument
name
- The name of the target exported function instance.
Error
If fail to find the target function, then an error is returned.
sourcepub fn get_table(&self, name: impl AsRef<str>) -> WasmEdgeResult<Table>
pub fn get_table(&self, name: impl AsRef<str>) -> WasmEdgeResult<Table>
Returns the exported table instance by name.
Argument
name
- The name of the target exported table instance.
Error
If fail to find the target table instance, then an error is returned.
sourcepub fn get_memory(&self, name: impl AsRef<str>) -> WasmEdgeResult<Memory>
pub fn get_memory(&self, name: impl AsRef<str>) -> WasmEdgeResult<Memory>
Returns the exported memory instance by name.
Argument
name
- The name of the target exported memory instance.
Error
If fail to find the target memory instance, then an error is returned.
sourcepub fn get_global(&self, name: impl AsRef<str>) -> WasmEdgeResult<Global>
pub fn get_global(&self, name: impl AsRef<str>) -> WasmEdgeResult<Global>
Returns the exported global instance by name.
Argument
name
- The name of the target exported global instance.
Error
If fail to find the target global instance, then an error is returned.
sourcepub fn func_len(&self) -> u32
pub fn func_len(&self) -> u32
Returns the length 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 table_len(&self) -> u32
pub fn table_len(&self) -> u32
Returns the length 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 mem_len(&self) -> u32
pub fn mem_len(&self) -> u32
Returns the length of the exported memory instances in this module instance.
sourcepub fn mem_names(&self) -> Option<Vec<String>>
pub fn mem_names(&self) -> Option<Vec<String>>
Returns the names of all exported memory instances in this module instance.
sourcepub fn global_len(&self) -> u32
pub fn global_len(&self) -> u32
Returns the length 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 host_data<T: Send + Sync + Clone>(&mut self) -> Option<&mut T>
pub fn host_data<T: Send + Sync + Clone>(&mut self) -> Option<&mut T>
Returns the host data held by the module instance.
sourcepub fn as_ptr(&self) -> *const WasmEdge_ModuleInstanceContext
Available on crate feature ffi
only.
pub fn as_ptr(&self) -> *const WasmEdge_ModuleInstanceContext
ffi
only.Provides a raw pointer to the inner module instance context.