Trait wasmtime_runtime::Store [−][src]
pub unsafe trait Store {
fn vminterrupts(&self) -> *mut VMInterrupts;
fn externref_activations_table(
&mut self
) -> (&mut VMExternRefActivationsTable, &dyn ModuleInfoLookup);
fn limiter(&mut self) -> Option<&mut dyn ResourceLimiter>;
fn out_of_gas(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>;
}
Expand description
Dynamic runtime functionality needed by this crate throughout the execution of a wasm instance.
This trait is used to store a raw pointer trait object within each
VMContext
. This raw pointer trait object points back to the
wasmtime::Store
internally but is type-erased so this wasmtime_runtime
crate doesn’t need the entire wasmtime
crate to build.
Note that this is an extra-unsafe trait because no heed is paid to the
lifetime of this store or the Send/Sync-ness of this store. All of that must
be respected by embedders (e.g. the wasmtime::Store
structure). The theory
is that wasmtime::Store
handles all this correctly.
Required methods
fn vminterrupts(&self) -> *mut VMInterrupts
fn vminterrupts(&self) -> *mut VMInterrupts
Returns the raw pointer in memory where this store’s shared
VMInterrupts
structure is located.
Used to configure VMContext
initialization and store the right pointer
in the VMContext
.
fn externref_activations_table(
&mut self
) -> (&mut VMExternRefActivationsTable, &dyn ModuleInfoLookup)
fn externref_activations_table(
&mut self
) -> (&mut VMExternRefActivationsTable, &dyn ModuleInfoLookup)
Returns the externref management structures necessary for this store.
The first element returned is the table in which externrefs are stored throughout wasm execution, and the second element is how to look up module information for gc requests.
fn limiter(&mut self) -> Option<&mut dyn ResourceLimiter>
fn limiter(&mut self) -> Option<&mut dyn ResourceLimiter>
Returns a reference to the store’s limiter for limiting resources, if any.