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.
Trait Implementations§
Source§impl AsMut<Instance> for WasiModule
impl AsMut<Instance> for WasiModule
Source§impl AsRef<Instance> for WasiModule
impl AsRef<Instance> for WasiModule
Auto Trait Implementations§
impl Freeze for WasiModule
impl RefUnwindSafe for WasiModule
impl Send for WasiModule
impl Sync for WasiModule
impl Unpin for WasiModule
impl UnsafeUnpin for WasiModule
impl UnwindSafe for WasiModule
Blanket Implementations§
Source§impl<Inst> AsInstance for Inst
impl<Inst> AsInstance for Inst
Source§fn get_table(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Table, &Self>>where
Self: Sized,
fn get_table(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Table, &Self>>where
Self: Sized,
Returns the exported table instance by name. Read more
Source§fn get_memory_ref(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &Self>>where
Self: Sized,
fn get_memory_ref(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &Self>>where
Self: Sized,
Returns the exported memory instance by name. Read more
fn get_memory_mut(
&mut self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Memory, &mut Self>>where
Self: Sized,
Source§fn get_global(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &Self>>where
Self: Sized,
fn get_global(
&self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &Self>>where
Self: Sized,
Returns the exported global instance by name. Read more
fn get_global_mut(
&mut self,
name: impl AsRef<str>,
) -> WasmEdgeResult<InnerRef<Global, &mut Self>>where
Self: Sized,
Source§fn func_len(&self) -> u32
fn func_len(&self) -> u32
Returns the length 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 get_func(&self, name: &str) -> WasmEdgeResult<FuncRef<&Instance>>
fn get_func(&self, name: &str) -> WasmEdgeResult<FuncRef<&Instance>>
Returns the exported function instance by name. Read more
Source§fn get_func_mut(&mut self, name: &str) -> WasmEdgeResult<FuncRef<&mut Instance>>
fn get_func_mut(&mut self, name: &str) -> WasmEdgeResult<FuncRef<&mut Instance>>
Returns the exported function instance by name. Read more
Source§fn table_len(&self) -> u32
fn table_len(&self) -> u32
Returns the length 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 mem_len(&self) -> u32
fn mem_len(&self) -> u32
Returns the length of the exported memory instances in this module instance.
Source§fn 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.
Source§fn global_len(&self) -> u32
fn global_len(&self) -> u32
Returns the length 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§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more