pub struct WasiModule(/* private fields */);
Expand description
A WasiModule is a module instance for the WASI specification.
Implementations§
Source§impl WasiModule
impl WasiModule
Sourcepub fn create(
args: Option<Vec<&str>>,
envs: Option<Vec<&str>>,
preopens: Option<Vec<&str>>,
) -> WasmEdgeResult<Self>
pub fn create( args: Option<Vec<&str>>, envs: Option<Vec<&str>>, preopens: Option<Vec<&str>>, ) -> WasmEdgeResult<Self>
Creates a WASI host module which contains the WASI host functions, and initializes it 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 isGUEST_PATH:HOST_PATH
.
§Error
If fail to create a host module, then an error is returned.
Sourcepub fn init_wasi(
&mut self,
args: Option<Vec<&str>>,
envs: Option<Vec<&str>>,
preopens: Option<Vec<&str>>,
)
pub fn init_wasi( &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 isGUEST_PATH:HOST_PATH
.
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.