pub struct InstanceAllocationRequest<'a> {
pub runtime_info: &'a Arc<dyn ModuleRuntimeInfo>,
pub imports: Imports<'a>,
pub host_state: Box<dyn Any + Send + Sync>,
pub store: StorePtr,
}
Expand description
Represents a request for a new runtime instance.
Fields
runtime_info: &'a Arc<dyn ModuleRuntimeInfo>
The info related to the compiled version of this module, needed for instantiation: function metadata, JIT code addresses, precomputed images for lazy memory and table initialization, and the like. This Arc is cloned and held for the lifetime of the instance.
imports: Imports<'a>
The imports to use for the instantiation.
host_state: Box<dyn Any + Send + Sync>
The host state to associate with the instance.
store: StorePtr
A pointer to the “store” for this instance to be allocated. The store
correlates with the Store
in wasmtime itself, and lots of contextual
information about the execution of wasm can be learned through the store.
Note that this is a raw pointer and has a static lifetime, both of which are a bit of a lie. This is done purely so a store can learn about itself when it gets called as a host function, and additionally so this runtime can access internals as necessary (such as the VMExternRefActivationsTable or the resource limiter methods).
Note that this ends up being a self-pointer to the instance when stored.
The reason is that the instance itself is then stored within the store.
We use a number of PhantomPinned
declarations to indicate this to the
compiler. More info on this in wasmtime/src/store.rs
Auto Trait Implementations
impl<'a> !RefUnwindSafe for InstanceAllocationRequest<'a>
impl<'a> !Send for InstanceAllocationRequest<'a>
impl<'a> !Sync for InstanceAllocationRequest<'a>
impl<'a> Unpin for InstanceAllocationRequest<'a>
impl<'a> !UnwindSafe for InstanceAllocationRequest<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more