Automatically generate *.wit bindings
Automatically generate *.wit bindings from any language, like Rust.
It becomes tedious (or borderline impossible) to manually write bindings for any kind of complex code. This is already a well-known (and solved) problem when it comes to generating C-bindings. In the Rust ecosystem, cbindgen crate aims to solve this.
Additional Context
I initially brought this up in the Zulip about a week ago (message link) but received no response.
Initial message (which also contains context of the problem I attempted to solve):
Hi, I'm thinking of using wit to export a Rust API from one crate and import it in another. The API is the Yew components. I would like to have a WASM package that exports those components and another package that imports them. Is it possible?
Example of component: https://github.com/yewstack/yew/blob/5570710cdf88658877b0ddc41e4b531cd7bdc7e6/examples/counter_functional/src/main.rs
cargo expandoutput: https://gist.github.com/hamza1311/61aaa9974825574ff066a3169de3b677When importing, the
BaseComponentimpl is needed so it can be consumed: https://api.yew.rs/next/yew/virtual_dom/struct.VComp.html#method.new
Since then, I've looked through some of the code and couldn't find any way to automatically generate bindings