WebAssembly Interfaces
A language bindings generator for wai
A Wasmer project building on
wai
## About
> **Note**: Unfortunately, the maintainers behind [`wit-bindgen`] didn’t want to
> [add support for Wasmer upstream], so we had to do a hard-fork in order to
> make things work with [Wasmer].
[`wit-bindgen`]: https://github.com/bytecodealliance/wit-bindgen
[add support for Wasmer upstream]: https://github.com/bytecodealliance/wit-bindgen/issues/306
[Wasmer]: https://wasmer.io
This project is a bindings generator framework for WebAssembly programs and
embeddings of WebAssembly. This works with `*.wai` files which describe the
interface of a module, either imported or exported. For example this project can
be used in cases such as:
* Your language (say, Rust) is compiled to WebAssembly and you'd like to import
WASI. This project will generate Rust bindings to import WASI APIs that are
described with `*.wai`.
* Your runtime (say, Wasmer) wants to then provide WASI functionality to guest
programs. This project will generate a Rust `trait` for you to implement for
the WASI interface.
* You're consuming a WebAssembly module (say, in a browser) and you don't want
to deal with funky ABI details. You'd use this project to generate JS bindings
which give you a TypeScript interface dealing with native JS types for the
WebAssembly module described by `*.wai`.
This project is based on the [interface types
proposal](https://github.com/webassembly/interface-types). This repository will be
following upstream changes. The purpose of `wai` is to provide a
forwards-compatible toolchain and story for interface types and a canonical ABI.
Generated language bindings all use the canonical ABI for communication,
enabling WebAssembly modules to be written in any language with support and for
WebAssembly modules to be consumed in any environment with language support.
## Demo
[View generated bindings
online!](https://wasmerio.github.io/wai/)
If you're curious to poke around and see what generated bindings look like for a
given input `*.wai`, you can explore the generated code online to get an idea
of what's being generated and what the glue code looks like.
## Usage
At this time a CLI tool is provided mostly for debugging and exploratory
purposes. It can be used easily with the `wasmer` CLI.
```wai
// browser.wai
record person {
name: string,
age: u32,
}
// Say hello to either the specified person or the current user
hello: func(who: option