pub(crate) struct Store {
pub(crate) inner: Box<StoreInner>,
}Expand description
The store represents all global state that can be manipulated by WebAssembly programs. It consists of the runtime representation of all instances of functions, tables, memories, and globals that have been allocated during the lifetime of the abstract machine.
The Store is tied to the underlying Engine that is — among many things — used to
compile the Wasm bytes into a valid module artifact.
For more informations, check out the [related WebAssembly specification] [related WebAssembly specification]: https://webassembly.github.io/spec/core/exec/runtime.html#store
Fields§
§inner: Box<StoreInner>Implementations§
Source§impl Store
impl Store
Sourcepub fn set_trap_handler(
&mut self,
handler: Option<Box<dyn Fn(i32, *const siginfo_t, *const c_void) -> bool + Sync + Send>>,
)
pub fn set_trap_handler( &mut self, handler: Option<Box<dyn Fn(i32, *const siginfo_t, *const c_void) -> bool + Sync + Send>>, )
Set the [TrapHandlerFn] for this store.
§Note
Not every implementor allows changing the trap handler. In those store that don’t allow it, this function has no effect.
Sourcepub fn engine_mut(&mut self) -> &mut Engine
pub fn engine_mut(&mut self) -> &mut Engine
Returns mutable reference to Engine.
Sourcepub fn same(a: &Store, b: &Store) -> bool
pub fn same(a: &Store, b: &Store) -> bool
Checks whether two stores are identical. A store is considered equal to another store if both have the same engine.
Sourcepub fn interrupter(&self) -> Interrupter
pub fn interrupter(&self) -> Interrupter
Builds an Interrupter for this store. Calling Interrupter::interrupt
will cause running WASM code to terminate immediately with a
HostInterrupt trap.
Best effort is made to ensure interrupts are handled. However, there is no guarantee; under rare circumstances, it is possible for the interrupt to be missed. One such case is when the target thread is about to call WASM code but has not yet made the call.
To make sure the code is interrupted, the target thread should notify the signalling thread that it has finished running in some way, and the signalling thread must wait for that notification and retry the interrupt if the notification is not received after some time. Embedders are expected to implement this logic.
If an interrupt is delivered while an imported function is running, the interrupt will simply be stored and processed only when the imported function returns control to WASM code. No effort is made to interrupt running imported functions. Embedders are expected to implement support for interruption of long-running or blocking imported functions separately.
Sourcepub fn into_async(self) -> StoreAsync
pub fn into_async(self) -> StoreAsync
Transforms this store into a StoreAsync which can be used
to invoke Function::call_async.
Trait Implementations§
Source§impl AsEngineRef for Store
impl AsEngineRef for Store
Source§impl AsStoreMut for Store
impl AsStoreMut for Store
Source§fn as_store_mut(&mut self) -> StoreMut<'_>
fn as_store_mut(&mut self) -> StoreMut<'_>
StoreMut pointing to the underlying context.Source§fn objects_mut(&mut self) -> &mut StoreObjects
fn objects_mut(&mut self) -> &mut StoreObjects
Source§impl AsStoreRef for Store
impl AsStoreRef for Store
Source§fn as_store_ref(&self) -> StoreRef<'_>
fn as_store_ref(&self) -> StoreRef<'_>
StoreRef pointing to the underlying context.Source§fn as_store_async(&self) -> Option<impl AsStoreAsync + 'static>
fn as_store_async(&self) -> Option<impl AsStoreAsync + 'static>
StoreAsync if the current
context is asynchronous. The store will be locked since
it’s already active in the current context, but can be used
to spawn new coroutines via
Function::call_async.impl Send for Store
impl Sync for Store
Auto Trait Implementations§
impl Freeze for Store
impl !RefUnwindSafe for Store
impl Unpin for Store
impl !UnwindSafe for Store
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
§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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read more