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
Trait Implementations§
Source§impl<Expr: Debug + Clone + PartialEq> Section<CoreIndexSpace, CoreSectionType> for Elem<Expr>
impl<Expr: Debug + Clone + PartialEq> Section<CoreIndexSpace, CoreSectionType> for Elem<Expr>
fn index_space(&self) -> CoreIndexSpace
fn section_type(&self) -> CoreSectionType
Source§impl<T: RetainsInstructions> TryFrom<&Elem<T>> for ElementSection
impl<T: RetainsInstructions> TryFrom<&Elem<T>> for ElementSection
impl<Expr> StructuralPartialEq for Elem<Expr>
Auto Trait Implementations§
impl<Expr> Freeze for Elem<Expr>
impl<Expr> RefUnwindSafe for Elem<Expr>where
Expr: RefUnwindSafe,
impl<Expr> Send for Elem<Expr>where
Expr: Send,
impl<Expr> Sync for Elem<Expr>where
Expr: Sync,
impl<Expr> Unpin for Elem<Expr>where
Expr: Unpin,
impl<Expr> UnwindSafe for Elem<Expr>where
Expr: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more