Struct wasmer_wasi::WasiEnv
source · Expand description
The environment provided to the WASI imports.
Fields§
§state: Arc<WasiState>
Shared state of the WASI system. Manages all the data that the executing WASI program can see.
Implementations§
source§impl WasiEnv
impl WasiEnv
sourcepub fn new(state: WasiState) -> Self
pub fn new(state: WasiState) -> Self
Create a new WasiEnv from a WasiState (memory will be set to None)
sourcepub fn runtime(&self) -> &dyn WasiRuntimeImplementation
pub fn runtime(&self) -> &dyn WasiRuntimeImplementation
Returns a copy of the current runtime implementation for this environment
sourcepub fn set_runtime<R>(&mut self, runtime: R)where
R: WasiRuntimeImplementation + Send + Sync + 'static,
pub fn set_runtime<R>(&mut self, runtime: R)where
R: WasiRuntimeImplementation + Send + Sync + 'static,
Overrides the runtime implementation for this environment
sourcepub fn current_thread_id(&self) -> WasiThreadId
pub fn current_thread_id(&self) -> WasiThreadId
Returns the current thread ID
sourcepub fn new_thread(&self) -> WasiThread
pub fn new_thread(&self) -> WasiThread
Creates a new thread only this wasi environment
sourcepub fn memory_clone(&self) -> Option<Memory>
pub fn memory_clone(&self) -> Option<Memory>
Copy the lazy reference so that when it’s initialized during the export phase, all the other references get a copy of it
pub fn yield_now(&self) -> Result<(), WasiError>
pub fn sleep(&self, duration: Duration) -> Result<(), WasiError>
sourcepub fn net(&self) -> &dyn VirtualNetworking
pub fn net(&self) -> &dyn VirtualNetworking
Accesses the virtual networking implementation
sourcepub fn bus(&self) -> &dyn VirtualBus
pub fn bus(&self) -> &dyn VirtualBus
Accesses the virtual bus implementation
sourcepub fn set_memory(&mut self, memory: Memory)
pub fn set_memory(&mut self, memory: Memory)
Set the memory of the WasiEnv (can only be done once)
sourcepub fn memory_view<'a>(&'a self, store: &'a impl AsStoreRef) -> MemoryView<'a>
pub fn memory_view<'a>(&'a self, store: &'a impl AsStoreRef) -> MemoryView<'a>
Providers safe access to the memory (it must be initialized before it can be used)