Struct wabt::Wat2Wasm
[−]
[src]
pub struct Wat2Wasm { /* fields omitted */ }
A builder for translate wasm text source to wasm binary format.
This version allows you to tweak parameters. If you need simple version
check out wat2wasm
.
Examples
extern crate wabt; use wabt::Wat2Wasm; fn main() { let wasm_binary = Wat2Wasm::new() .canonicalize_lebs(false) .write_debug_names(true) .convert( r#" (module (import "spectest" "print" (func $print (param i32))) (func (export "main") i32.const 1312 call $print ) ) "# ).unwrap(); }
Methods
impl Wat2Wasm
[src]
fn new() -> Wat2Wasm
[src]
Create Wat2Wasm
with default configuration.
fn canonicalize_lebs(&mut self, canonicalize_lebs: bool) -> &mut Wat2Wasm
[src]
Write canonicalized LEB128 for var ints.
Set this to false
to write all LEB128 sizes as 5-bytes instead of their minimal size.
true
by default.
fn relocatable(&mut self, relocatable: bool) -> &mut Wat2Wasm
[src]
Create a relocatable wasm binary
(suitable for linking with wasm-link).
false
by default.
fn write_debug_names(&mut self, write_debug_names: bool) -> &mut Wat2Wasm
[src]
Write debug names to the generated binary file
false
by default.
fn validate(&mut self, validate: bool) -> &mut Wat2Wasm
[src]
Check for validity of module before writing.
true
by default.
fn convert<S: AsRef<[u8]>>(&self, source: S) -> Result<WabtBuf, Error>
[src]
Perform conversion.