[−][src]Struct wabt::Wat2Wasm
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]
impl Wat2Wasm
pub fn new() -> Wat2Wasm
[src]
pub fn new() -> Wat2Wasm
Create Wat2Wasm
with default configuration.
pub fn canonicalize_lebs(&mut self, canonicalize_lebs: bool) -> &mut Wat2Wasm
[src]
pub fn canonicalize_lebs(&mut self, canonicalize_lebs: bool) -> &mut Wat2Wasm
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.
pub fn relocatable(&mut self, relocatable: bool) -> &mut Wat2Wasm
[src]
pub fn relocatable(&mut self, relocatable: bool) -> &mut Wat2Wasm
Create a relocatable wasm binary
(suitable for linking with wasm-link).
false
by default.
pub fn write_debug_names(&mut self, write_debug_names: bool) -> &mut Wat2Wasm
[src]
pub fn write_debug_names(&mut self, write_debug_names: bool) -> &mut Wat2Wasm
Write debug names to the generated binary file
false
by default.
pub fn validate(&mut self, validate: bool) -> &mut Wat2Wasm
[src]
pub fn validate(&mut self, validate: bool) -> &mut Wat2Wasm
Check for validity of module before writing.
true
by default.
pub fn convert<S: AsRef<[u8]>>(&self, source: S) -> Result<WabtBuf, Error>
[src]
pub fn convert<S: AsRef<[u8]>>(&self, source: S) -> Result<WabtBuf, Error>
Perform conversion.
Auto Trait Implementations
Blanket Implementations
impl<T> FromBits for T
[src]
impl<T> FromBits for T
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 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]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,