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§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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