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
sourceimpl Debug for TableInitialization
impl Debug for TableInitialization
sourceimpl Default for TableInitialization
impl Default for TableInitialization
sourceimpl<'de> Deserialize<'de> for TableInitialization
impl<'de> Deserialize<'de> for TableInitialization
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for TableInitialization
impl Serialize for TableInitialization
Auto Trait Implementations
impl RefUnwindSafe for TableInitialization
impl Send for TableInitialization
impl Sync for TableInitialization
impl Unpin for TableInitialization
impl UnwindSafe for TableInitialization
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more