WABT bindings for Rust
Rust bindings for WABT. Work in progress.
Usage
Add this to your Cargo.toml
:
[]
= "0.1"
Example
wat2wasm
:
extern crate wabt;
use wat2wasm;
wasm2wat
:
extern crate wabt;
use wasm2wat;
Rust bindings for WABT. Work in progress.
Add this to your Cargo.toml
:
[dependencies]
wabt = "0.1"
wat2wasm
:
extern crate wabt;
use wabt::wat2wasm;
fn main() {
assert_eq!(
wat2wasm("(module)").unwrap(),
&[
0, 97, 115, 109, // \0ASM - magic
1, 0, 0, 0 // 0x01 - version
]
);
}
wasm2wat
:
extern crate wabt;
use wabt::wasm2wat;
fn main() {
assert_eq!(
wasm2wat(&[
0, 97, 115, 109, // \0ASM - magic
1, 0, 0, 0 // 01 - version
]),
Ok("(module)\n".to_owned()),
);
}