Struct wasmtime_runtime::InstanceAllocationRequest

source ·
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,
    pub wmemcheck: bool,
    pub pkey: Option<ProtectionKey>,
}
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

§wmemcheck: bool

Indicates ‘–wmemcheck’ flag.

§pkey: Option<ProtectionKey>

Request that the instance’s memories be protected by a specific protection key.

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
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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.