[][src]Struct wabt::Wat2Wasm

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]

Create Wat2Wasm with default configuration.

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.

Create a relocatable wasm binary

(suitable for linking with wasm-link). false by default.

Write debug names to the generated binary file

false by default.

Check for validity of module before writing.

true by default.

Perform conversion.

Auto Trait Implementations

impl Send for Wat2Wasm

impl Sync for Wat2Wasm

Blanket Implementations

impl<T> FromBits for T
[src]

Convert other to Self, preserving bitwise representation

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.