Struct wasmedge_sdk::wasi::WasiInstance
source · pub struct WasiInstance { /* private fields */ }
Expand description
Represents a wasi module instance.
Implementations§
source§impl WasiInstance
impl WasiInstance
sourcepub fn initialize(
&mut self,
args: Option<Vec<&str>>,
envs: Option<Vec<&str>>,
preopens: Option<Vec<&str>>
)
pub fn initialize(
&mut self,
args: Option<Vec<&str>>,
envs: Option<Vec<&str>>,
preopens: Option<Vec<&str>>
)
Initializes the WASI host module with the given parameters.
Arguments
-
args
- The commandline arguments. The first argument is the program name. -
envs
- The environment variables in the formatENV_VAR_NAME=VALUE
. -
preopens
- The directories to pre-open. The required format isDIR1:DIR2
.
sourcepub fn exit_code(&self) -> u32
pub fn exit_code(&self) -> u32
Returns the WASI exit code.
The WASI exit code can be accessed after running the “_start” function of a wasm32-wasi
program.
sourcepub fn native_handler(&self, fd: i32) -> WasmEdgeResult<u64>
pub fn native_handler(&self, fd: i32) -> WasmEdgeResult<u64>
Trait Implementations§
source§impl AsInstance for WasiInstance
impl AsInstance for WasiInstance
source§fn name(&self) -> &str
fn name(&self) -> &str
Returns the name of this exported module instance.
If this module instance is an active instance, return None.
source§fn func_count(&self) -> usize
fn func_count(&self) -> usize
Returns the count of the exported function instances in this module instance.
source§fn 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.
source§fn func(&self, name: impl AsRef<str>) -> WasmEdgeResult<Func>
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.
source§fn global_count(&self) -> usize
fn global_count(&self) -> usize
Returns the count of the exported global instances in this module instance.
source§fn 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.
source§fn global(&self, name: impl AsRef<str>) -> WasmEdgeResult<Global>
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.
source§fn memory_count(&self) -> usize
fn memory_count(&self) -> usize
Returns the count of the exported memory instances in this module instance.
source§fn memory_names(&self) -> Option<Vec<String>>
fn memory_names(&self) -> Option<Vec<String>>
Returns the names of the exported memory instances in this module instance.
source§fn memory(&self, name: impl AsRef<str>) -> WasmEdgeResult<Memory>
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.
source§fn table_count(&self) -> usize
fn table_count(&self) -> usize
Returns the count of the exported table instances in this module instance.
source§fn 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.
source§fn table(&self, name: impl AsRef<str>) -> WasmEdgeResult<Table>
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.
source§impl Clone for WasiInstance
impl Clone for WasiInstance
source§fn clone(&self) -> WasiInstance
fn clone(&self) -> WasiInstance
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more