Struct golem_wasm_ast::core::Elem
source · pub struct Elem<Expr> {
pub ref_type: RefType,
pub init: Vec<Expr>,
pub mode: ElemMode,
}
Expand description
The initial contents of a table is uninitialized. Element segments can be used to initialize a subrange of a table from a static vector of elements.
The elems component of a module defines a vector of element segments. Each element segment defines a reference type and a corresponding list of constant element expressions.
Element segments have a mode that identifies them as either passive, active, or declarative. A passive element segment’s elements can be copied to a table using the table.init instruction. An active element segment copies its elements into a table during instantiation, as specified by a table index and a constant expression defining an offset into that table. A declarative element segment is not available at runtime but merely serves to forward-declare references that are formed in code with instructions like ref.func.
Element segments are referenced through element indices.
Fields§
§ref_type: RefType
§init: Vec<Expr>
§mode: ElemMode