wasmtime_environ::component

Enum GlobalInitializer

Source
pub enum GlobalInitializer {
    InstantiateModule(InstantiateModule),
    LowerImport {
        index: LoweredIndex,
        import: RuntimeImportIndex,
    },
    ExtractMemory(ExtractMemory),
    ExtractRealloc(ExtractRealloc),
    ExtractPostReturn(ExtractPostReturn),
    Resource(Resource),
}
Expand description

GlobalInitializer instructions to get processed when instantiating a component

The variants of this enum are processed during the instantiation phase of a component in-order from front-to-back. These are otherwise emitted as a component is parsed and read and translated.

Variants§

§

InstantiateModule(InstantiateModule)

A core wasm module is being instantiated.

This will result in a new core wasm instance being created, which may involve running the start function of the instance as well if it’s specified. This largely delegates to the same standard instantiation process as the rest of the core wasm machinery already uses.

§

LowerImport

A host function is being lowered, creating a core wasm function.

This initializer entry is intended to be used to fill out the VMComponentContext and information about this lowering such as the cranelift-compiled trampoline function pointer, the host function pointer the trampoline calls, and the canonical ABI options.

Fields

§index: LoweredIndex

The index of the lowered function that’s being created.

This is guaranteed to be the nth LowerImport instruction if the index is n.

§import: RuntimeImportIndex

The index of the imported host function that is being lowered.

It’s guaranteed that this RuntimeImportIndex points to a function.

§

ExtractMemory(ExtractMemory)

A core wasm linear memory is going to be saved into the VMComponentContext.

This instruction indicates that the indexth core wasm linear memory needs to be extracted from the export specified, a pointer to a previously created module instance, and stored into the VMComponentContext at the index specified. This lowering is then used in the future by pointers from CanonicalOptions.

§

ExtractRealloc(ExtractRealloc)

Same as ExtractMemory, except it’s extracting a function pointer to be used as a realloc function.

§

ExtractPostReturn(ExtractPostReturn)

Same as ExtractMemory, except it’s extracting a function pointer to be used as a post-return function.

§

Resource(Resource)

Declares a new defined resource within this component.

Contains information about the destructor, for example.

Trait Implementations§

Source§

impl Debug for GlobalInitializer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GlobalInitializer

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for GlobalInitializer

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

Source§

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

Source§

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,