Struct wasmer_wasix::state::func_env::WasiFunctionEnv
source · pub struct WasiFunctionEnv {
pub env: FunctionEnv<WasiEnv>,
}
Fields§
§env: FunctionEnv<WasiEnv>
Implementations§
source§impl WasiFunctionEnv
impl WasiFunctionEnv
pub fn new(store: &mut impl AsStoreMut, env: WasiEnv) -> Self
pub fn new_with_store( module: Module, env: WasiEnv, store_snapshot: Option<&StoreSnapshot>, spawn_type: SpawnMemoryType<'_>, update_layout: bool, ) -> Result<(Self, Store), WasiThreadError>
sourcepub fn import_object(
&self,
store: &mut impl AsStoreMut,
module: &Module,
) -> Result<Imports, WasiError>
pub fn import_object( &self, store: &mut impl AsStoreMut, module: &Module, ) -> Result<Imports, WasiError>
Get an Imports
for a specific version of WASI detected in the module.
sourcepub fn data<'a>(&'a self, store: &'a impl AsStoreRef) -> &'a WasiEnv
pub fn data<'a>(&'a self, store: &'a impl AsStoreRef) -> &'a WasiEnv
Gets a reference to the WasiEnvironment
sourcepub fn data_mut<'a>(&'a self, store: &'a mut impl AsStoreMut) -> &'a mut WasiEnv
pub fn data_mut<'a>(&'a self, store: &'a mut impl AsStoreMut) -> &'a mut WasiEnv
Gets a mutable- reference to the host state in this context.
sourcepub fn initialize(
&mut self,
store: &mut impl AsStoreMut,
instance: Instance,
) -> Result<(), ExportError>
pub fn initialize( &mut self, store: &mut impl AsStoreMut, instance: Instance, ) -> Result<(), ExportError>
Initializes the WasiEnv using the instance exports (this must be executed before attempting to use it) (as the stores can not by themselves be passed between threads we can store the module in a thread-local variables and use it later - for multithreading)
sourcepub fn initialize_with_memory(
&mut self,
store: &mut impl AsStoreMut,
instance: Instance,
memory: Option<Memory>,
update_layout: bool,
) -> Result<(), ExportError>
pub fn initialize_with_memory( &mut self, store: &mut impl AsStoreMut, instance: Instance, memory: Option<Memory>, update_layout: bool, ) -> Result<(), ExportError>
Initializes the WasiEnv using the instance exports and a provided optional memory (this must be executed before attempting to use it) (as the stores can not by themselves be passed between threads we can store the module in a thread-local variables and use it later - for multithreading)
sourcepub fn import_object_for_all_wasi_versions(
&self,
store: &mut impl AsStoreMut,
module: &Module,
) -> Result<Imports, WasiError>
pub fn import_object_for_all_wasi_versions( &self, store: &mut impl AsStoreMut, module: &Module, ) -> Result<Imports, WasiError>
Like import_object
but containing all the WASI versions detected in
the module.
sourcepub fn on_exit(
&self,
store: &mut impl AsStoreMut,
process_exit_code: Option<ExitCode>,
)
pub fn on_exit( &self, store: &mut impl AsStoreMut, process_exit_code: Option<ExitCode>, )
§Safety
This function should only be called from within a syscall as it can potentially execute local thread variable cleanup code
sourcepub unsafe fn bootstrap(
&self,
store: &mut impl AsStoreMut,
) -> Result<RewindStateOption, WasiRuntimeError>
pub unsafe fn bootstrap( &self, store: &mut impl AsStoreMut, ) -> Result<RewindStateOption, WasiRuntimeError>
Bootstraps this main thread and context with any journals that may be present
§Safety
This function manipulates the memory of the process and thus must be executed by the WASM process thread itself.
Trait Implementations§
source§impl Clone for WasiFunctionEnv
impl Clone for WasiFunctionEnv
source§fn clone(&self) -> WasiFunctionEnv
fn clone(&self) -> WasiFunctionEnv
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for WasiFunctionEnv
impl !RefUnwindSafe for WasiFunctionEnv
impl Send for WasiFunctionEnv
impl Sync for WasiFunctionEnv
impl Unpin for WasiFunctionEnv
impl !UnwindSafe for WasiFunctionEnv
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more