A Bytecode Alliance project
Usage
Add this to your Cargo.toml
:
[]
= "0.3"
And then you can encode WebAssembly binaries via:
use ;
let mut module = new;
// Encode the type section.
let mut types = new;
let params = vec!;
let results = vec!;
types.function;
module.section;
// Encode the function section.
let mut functions = new;
let type_index = 0;
functions.function;
module.section;
// Encode the export section.
let mut exports = new;
exports.export;
module.section;
// Encode the code section.
let mut codes = new;
let locals = vec!;
let mut f = new;
f.instruction;
f.instruction;
f.instruction;
f.instruction;
codes.function;
module.section;
// Extract the encoded Wasm bytes for this module.
let wasm_bytes = module.finish;
// We generated a valid Wasm module!
assert!;
License
This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.