Trait wasmedge_sys::AsInstance
source · pub trait AsInstance {
// Required methods
fn get_func(&self, name: impl AsRef<str>) -> WasmEdgeResult<Function>;
fn func_len(&self) -> u32;
fn func_names(&self) -> Option<Vec<String>>;
fn get_table(&self, name: impl AsRef<str>) -> WasmEdgeResult<Table>;
fn table_len(&self) -> u32;
fn table_names(&self) -> Option<Vec<String>>;
fn get_memory(&self, name: impl AsRef<str>) -> WasmEdgeResult<Memory>;
fn mem_len(&self) -> u32;
fn mem_names(&self) -> Option<Vec<String>>;
fn get_global(&self, name: impl AsRef<str>) -> WasmEdgeResult<Global>;
fn global_len(&self) -> u32;
fn global_names(&self) -> Option<Vec<String>>;
}
Expand description
The object as an module instance is required to implement this trait.
Required Methods§
sourcefn get_func(&self, name: impl AsRef<str>) -> WasmEdgeResult<Function>
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.
sourcefn func_len(&self) -> u32
fn func_len(&self) -> u32
Returns the length of the exported function instances in this module instance.
sourcefn func_names(&self) -> Option<Vec<String>>
fn func_names(&self) -> Option<Vec<String>>
Returns the names of the exported function instances in this module instance.
sourcefn get_table(&self, name: impl AsRef<str>) -> WasmEdgeResult<Table>
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.
sourcefn table_len(&self) -> u32
fn table_len(&self) -> u32
Returns the length of the exported table instances in this module instance.
sourcefn table_names(&self) -> Option<Vec<String>>
fn table_names(&self) -> Option<Vec<String>>
Returns the names of the exported table instances in this module instance.
sourcefn get_memory(&self, name: impl AsRef<str>) -> WasmEdgeResult<Memory>
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.
sourcefn mem_len(&self) -> u32
fn mem_len(&self) -> u32
Returns the length of the exported memory instances in this module instance.
sourcefn mem_names(&self) -> Option<Vec<String>>
fn mem_names(&self) -> Option<Vec<String>>
Returns the names of all exported memory instances in this module instance.
sourcefn get_global(&self, name: impl AsRef<str>) -> WasmEdgeResult<Global>
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.
sourcefn global_len(&self) -> u32
fn global_len(&self) -> u32
Returns the length of the exported global instances in this module instance.
sourcefn global_names(&self) -> Option<Vec<String>>
fn global_names(&self) -> Option<Vec<String>>
Returns the names of the exported global instances in this module instance.