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

source

pub fn new(memory: Memory, store: &impl AsStoreRef, instance: Instance) -> Self

source

pub fn module(&self) -> &Module

source

pub fn module_clone(&self) -> Module

source

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)

source

pub fn memory(&self) -> &Memory

Providers safe access to the memory (it must be initialized before it can be used)

source

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

source

pub fn instance(&self) -> &Instance

Trait Implementations§

source§

impl Clone for WasiInstanceHandles

source§

fn clone(&self) -> WasiInstanceHandles

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for WasiInstanceHandles

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for T
where T: Any + Debug + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,