Struct wasm_encoder::ElementSection [−][src]
pub struct ElementSection { /* fields omitted */ }Expand description
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
Create a new element section encoder.
Define an element segment.
Define an active element segment.
Encode a passive element segment.
Passive segments are part of the bulk memory proposal.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ElementSectionimpl Send for ElementSectionimpl Sync for ElementSectionimpl Unpin for ElementSectionimpl UnwindSafe for ElementSectionBlanket Implementations
Mutably borrows from an owned value. Read more