Enum wasmtime_environ::TableInitialization

source ·
pub enum TableInitialization {
    Segments {
        segments: Vec<TableInitializer>,
    },
    FuncTable {
        tables: PrimaryMap<TableIndex, Vec<FuncIndex>>,
        segments: Vec<TableInitializer>,
    },
}
Expand description

Table initialization data for all tables in the module.

Variants§

§

Segments

“Segment” mode: table initializer segments, possibly with dynamic bases, possibly applying to an imported memory.

Every kind of table initialization is supported by the Segments mode.

Fields

§segments: Vec<TableInitializer>

The segment initializers. All apply to the table for which this TableInitialization is specified.

§

FuncTable

“FuncTable” mode: a single array per table, with a function index or null per slot. This is only possible to provide for a given table when it is defined by the module itself, and can only include data from initializer segments that have statically-knowable bases (i.e., not dependent on global values).

Any segments that are not compatible with this mode are held in the segments array of “leftover segments”, which are still processed eagerly.

This mode facilitates lazy initialization of the tables. It is thus “nice to have”, but not necessary for correctness.

Fields

§tables: PrimaryMap<TableIndex, Vec<FuncIndex>>

For each table, an array of function indices (or FuncIndex::reserved_value(), meaning no initialized value, hence null by default). Array elements correspond one-to-one to table elements; i.e., elements[i] is the initial value for table[i].

§segments: Vec<TableInitializer>

Leftover segments that need to be processed eagerly on instantiation. These either apply to an imported table (so we can’t pre-build a full image of the table from this overlay) or have dynamically (at instantiation time) determined bases.

Trait Implementations§

source§

impl Debug for TableInitialization

source§

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

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

impl Default for TableInitialization

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for TableInitialization

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 TableInitialization

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

§

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

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