[−][src]Function wabt::wat2wasm_with_features
pub fn wat2wasm_with_features<S: AsRef<[u8]>>(
source: S,
features: Features
) -> Result<Vec<u8>, Error>
Translate wasm text source to wasm binary format.
If wasm source is valid wasm binary will be returned in the vector. Returned binary is validated and can be executed.
This function will make translation with custom features.
If you want to find out what default parameters are or you want to tweak them
you can use Wat2Wasm
For more examples and online demo you can check online version of wat2wasm.
Examples
extern crate wabt; use wabt::{Features, wat2wasm_with_features}; fn main() { let mut features = Features::new(); features.enable_simd(); assert_eq!( wat2wasm_with_features("(module)", features).unwrap(), &[ 0, 97, 115, 109, // \0ASM - magic 1, 0, 0, 0 // 0x01 - version ] ); }