A Rust parser for the WebAssembly Text format
Parse an in-memory string:
let wat = r#" (module (func $foo) (func (export "bar") call $foo ) ) "#; let binary = wat::parse_str(wat)?; // ...
Parse an on-disk file:
let binary = wat::parse_file("./foo.wat")?; // ...
WebAssembly, and the WAT format, are an evolving specification. Features are added to WAT, WAT changes, and sometimes WAT breaks. The policy of this crate is that it will always follow the official specification for WAT files.
Future WebAssembly features will be accepted to this parser and they will not require a feature gate to opt-in. All implemented WebAssembly features will be enabled at all times. Using a future WebAssembly feature in the WAT format may cause breakage because while specifications are in development the WAT syntax (and/or binary encoding) will often change. This crate will do its best to keep up with these proposals, but breaking textual changes will be published as non-breaking semver changes to this crate.
This crate is intended to be a very stable shim over the
which is expected to be much more unstable. The
wast crate contains
AST data structures for parsing
*.wat files and they will evolve was the
WAT and WebAssembly specifications evolve over time.
This crate is currently at version 1.x.y, and it is intended that it will remain here for quite some time. Breaking changes to the WAT format will be landed as a non-semver-breaking version change in this crate. This crate will always follow the official specification for WAT.
Errors from this crate related to parsing WAT files
Parses in-memory bytes as either the WebAssembly Text format, or a binary WebAssembly module.
Parses a file on disk as a WebAssembly Text format file, or a binary WebAssembly file
Parses an in-memory string as the WebAssembly Text format, returning the file as a binary WebAssembly file.
A convenience type definition for