[−][src]Struct wasm_encoder::ElementSection
An encoder for the element section.
Example
use wasm_encoder::{ Elements, ElementSection, Instruction, Module, TableSection, TableType, Limits, ValType, }; let mut tables = TableSection::new(); tables.table(TableType { element_type: ValType::FuncRef, limits: Limits { min: 128, max: None, }, }); let mut elements = ElementSection::new(); let table_index = 0; let offset = Instruction::I32Const(42); let element_type = ValType::FuncRef; let functions = Elements::Functions(&[ // Function indices... ]); elements.active(Some(table_index), offset, element_type, functions); let mut module = Module::new(); module .section(&tables) .section(&elements); let wasm_bytes = module.finish();
Implementations
impl ElementSection
[src]
pub fn new() -> ElementSection
[src]
Create a new element section encoder.
pub fn segment<'a>(&mut self, segment: ElementSegment<'a>) -> &mut Self
[src]
Define an element segment.
pub fn active<'a>(
&mut self,
table_index: Option<u32>,
offset: Instruction<'_>,
element_type: ValType,
elements: Elements<'a>
) -> &mut Self
[src]
&mut self,
table_index: Option<u32>,
offset: Instruction<'_>,
element_type: ValType,
elements: Elements<'a>
) -> &mut Self
Define an active element segment.
pub fn passive<'a>(
&mut self,
element_type: ValType,
elements: Elements<'a>
) -> &mut Self
[src]
&mut self,
element_type: ValType,
elements: Elements<'a>
) -> &mut Self
Encode a passive element segment.
Passive segments are part of the bulk memory proposal.
pub fn declared<'a>(
&mut self,
element_type: ValType,
elements: Elements<'a>
) -> &mut Self
[src]
&mut self,
element_type: ValType,
elements: Elements<'a>
) -> &mut Self
Encode a declared element segment.
Declared segments are part of the bulk memory proposal.
Trait Implementations
impl Section for ElementSection
[src]
Auto Trait Implementations
impl RefUnwindSafe for ElementSection
impl Send for ElementSection
impl Sync for ElementSection
impl Unpin for ElementSection
impl UnwindSafe for ElementSection
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,