This is an experimental crate for validating the imports and exports of a WebAssembly module.
For the time being, Wasm Interface provides:
- a convenient text format for specifying the requirements of Wasm modules
- a convenient way to compose interfaces safely (it ensures no conflicts (duplicates are allowed but they must agree))
- validation that the modules meet the requirements
Here's the interface for the current version of WASI:
assert-exportdeclarations are allowed.
- comments (starts with
;and ends with a newline) and whitespace are valid between any tokens
All imports used by the module must be specified in the interface.
All exports in the interface must be exported by the module.
Thus the module may have additional exports than the interface or fewer imports than the interface specifies and be considered valid.
Wasm Interface serves a slightly different purpose than the proposed WebIDL for Wasm standard, but may be replaced by it in the future if things change.
Due to an issue with nested closures in Rust,
wasm-interface can't both compile on stable and have good error reporting. This is being fixed and
wasm-interface will be updated to have better error handling.
parser.rs file for a comment containing the grammar in a BNF style.
Suggestions, contributions, and thoughts welcome! This is an experiment in the early stages, but we hope to work with the wider community and develop this in cooperation with all interested parties.