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

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.