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,
ValType,
};
let mut tables = TableSection::new();
tables.table(TableType {
element_type: ValType::FuncRef,
minimum: 128,
maximum: 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 ElementSection
impl Send for ElementSection
impl Sync for ElementSection
impl Unpin for ElementSection
impl UnwindSafe for ElementSection
Blanket Implementations
Mutably borrows from an owned value. Read more