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

Fields

segments: Vec<TableInitializer>

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

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

FuncTable

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.

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

Trait Implementations

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

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.