WITX is a way to describe types and function interfaces for WebAssembly modules.
From this, code generators can produce code to access data and call functions from different languages using the same layout and calling conventions.
The generated code is compatible with the WebAssembly standard APIs (WASI).
This tool uses the next (as on April 5th, 2021) revision of the format definition, as implemented in the forthcoming version 0.10 of the Rust witx
crate.
witx-codegen
is written in Rust, but is language-agnostic. The output is meant to be simple to understand.
The tool can also produce different documentation formats.
witx-codegen
supersedes as-witx
, zig-witx
, witx-docgen
, witx-overview-docgen
and witx-generate-raw
.
cargo
:sh
cargo install witx-codegen
```text WITX code generator for WebAssembly guest modules
USAGE:
witx-codegen [FLAGS] [OPTIONS]
FLAGS: -h, --help Prints help information -H, --skip-header Do not generate a header -I, --skip-imports Ignores imported types and functions -V, --version Prints version information
OPTIONS:
-m, --module-name
-o, --output <output_file> Output file, or - for the standard output
-t, --output-type <output_type>
Output type. One in: {assemblyscript, zig, rust, overview, markdown}
[default: assemblyscript]
ARGS:
See the test
folder for examples of WITX input files.
Other input formats may also be eventually supported, as well as extensions to produce more structured documentation.