Exporting Rust struct/enum/trait/fn to JS

I'm familiar with the js! macro from stdweb. It's great for situations where I want to pass some Rust objects to a JS function and get a result back in Rust land.

Here I'm trying to do something different. I'm building a wasm32 app where (1) the primitives are written in Rust and (2) I can script/glue the primitives via JS. So I particular, I'd like to be able to construct struct/enums and call trait functions.

Is there any pre-existing crate with macros for "exporting" Rust structs/enums/traits/fns to JS land?

It sounds like you want wasm-bindgen.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.