Struct wasm_encoder::CodeSection [−][src]
pub struct CodeSection { /* fields omitted */ }
Expand description
An encoder for the code section.
Example
use wasm_encoder::{
CodeSection, Function, FunctionSection, Instruction, Module,
TypeSection, ValType
};
let mut types = TypeSection::new();
types.function(vec![], vec![ValType::I32]);
let mut functions = FunctionSection::new();
let type_index = 0;
functions.function(type_index);
let locals = vec![];
let mut func = Function::new(locals);
func.instruction(Instruction::I32Const(42));
let mut code = CodeSection::new();
code.function(&func);
let mut module = Module::new();
module
.section(&types)
.section(&functions)
.section(&code);
let wasm_bytes = module.finish();
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for CodeSection
impl Send for CodeSection
impl Sync for CodeSection
impl Unpin for CodeSection
impl UnwindSafe for CodeSection
Blanket Implementations
Mutably borrows from an owned value. Read more