Struct wasmer_wasix::state::env::WasiInstanceHandles
source · pub struct WasiInstanceHandles {Show 17 fields
pub(crate) memory: Memory,
pub(crate) instance: Instance,
pub(crate) stack_pointer: Option<Global>,
pub(crate) data_end: Option<Global>,
pub(crate) stack_low: Option<Global>,
pub(crate) stack_high: Option<Global>,
pub(crate) start: Option<TypedFunction<(), ()>>,
pub(crate) initialize: Option<TypedFunction<(), ()>>,
pub(crate) thread_spawn: Option<TypedFunction<(i32, i32), ()>>,
pub(crate) signal: Option<TypedFunction<i32, ()>>,
pub(crate) signal_set: bool,
pub(crate) has_stack_checkpoint: bool,
pub(crate) asyncify_start_unwind: Option<TypedFunction<i32, ()>>,
pub(crate) asyncify_stop_unwind: Option<TypedFunction<(), ()>>,
pub(crate) asyncify_start_rewind: Option<TypedFunction<i32, ()>>,
pub(crate) asyncify_stop_rewind: Option<TypedFunction<(), ()>>,
pub(crate) asyncify_get_state: Option<TypedFunction<(), i32>>,
}
Expand description
Various TypedFunction
and Global
handles for an active WASI(X) instance.
Used to access and modify runtime state.
Fields§
§memory: Memory
Represents a reference to the memory
instance: Instance
§stack_pointer: Option<Global>
Points to the current location of the memory stack pointer
data_end: Option<Global>
Points to the end of the data section
stack_low: Option<Global>
Points to the lower end of the stack
stack_high: Option<Global>
Points to the higher end of the stack
start: Option<TypedFunction<(), ()>>
Main function that will be invoked (name = “_start”)
initialize: Option<TypedFunction<(), ()>>
Function thats invoked to initialize the WASM module (name = “_initialize”)
thread_spawn: Option<TypedFunction<(i32, i32), ()>>
Represents the callback for spawning a thread (name = “wasi_thread_start”) (due to limitations with i64 in browsers the parameters are broken into i32 pairs) [this takes a user_data field]
signal: Option<TypedFunction<i32, ()>>
Represents the callback for signals (name = “__wasm_signal”) Signals are triggered asynchronously at idle times of the process
signal_set: bool
Flag that indicates if the signal callback has been set by the WASM process - if it has not been set then the runtime behaves differently when a CTRL-C is pressed.
has_stack_checkpoint: bool
Flag that indicates if the stack capture exports are being used by this WASM process which means that it will be using asyncify
asyncify_start_unwind: Option<TypedFunction<i32, ()>>
asyncify_start_unwind(data : i32): call this to start unwinding the stack from the current location. “data” must point to a data structure as described above (with fields containing valid data).
asyncify_stop_unwind: Option<TypedFunction<(), ()>>
asyncify_stop_unwind(): call this to note that unwinding has concluded. If no other code will run before you start to rewind, this is not strictly necessary, however, if you swap between coroutines, or even just want to run some normal code during a “sleep”, then you must call this at the proper time. Otherwise, the code will think it is still unwinding when it should not be, which means it will keep unwinding in a meaningless way.
asyncify_start_rewind: Option<TypedFunction<i32, ()>>
asyncify_start_rewind(data : i32): call this to start rewinding the stack vack up to the location stored in the provided data. This prepares for the rewind; to start it, you must call the first function in the call stack to be unwound.
asyncify_stop_rewind: Option<TypedFunction<(), ()>>
asyncify_stop_rewind(): call this to note that rewinding has concluded, and normal execution can resume.
asyncify_get_state: Option<TypedFunction<(), i32>>
asyncify_get_state(): call this to get the current value of the internal “__asyncify_state” variable as described above. It can be used to distinguish between unwinding/rewinding and normal calls, so that you know when to start an asynchronous operation and when to propagate results back.
Implementations§
source§impl WasiInstanceHandles
impl WasiInstanceHandles
pub fn new(memory: Memory, store: &impl AsStoreRef, instance: Instance) -> Self
pub fn module(&self) -> &Module
pub fn module_clone(&self) -> Module
sourcepub fn memory_view<'a>(
&'a self,
store: &'a (impl AsStoreRef + ?Sized),
) -> MemoryView<'a>
pub fn memory_view<'a>( &'a self, store: &'a (impl AsStoreRef + ?Sized), ) -> MemoryView<'a>
Providers safe access to the memory (it must be initialized before it can be used)
sourcepub fn memory(&self) -> &Memory
pub fn memory(&self) -> &Memory
Providers safe access to the memory (it must be initialized before it can be used)
sourcepub fn memory_clone(&self) -> Memory
pub fn memory_clone(&self) -> 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 instance(&self) -> &Instance
Trait Implementations§
source§impl Clone for WasiInstanceHandles
impl Clone for WasiInstanceHandles
source§fn clone(&self) -> WasiInstanceHandles
fn clone(&self) -> WasiInstanceHandles
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 WasiInstanceHandles
impl RefUnwindSafe for WasiInstanceHandles
impl Send for WasiInstanceHandles
impl Sync for WasiInstanceHandles
impl Unpin for WasiInstanceHandles
impl UnwindSafe for WasiInstanceHandles
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