WebAssembly for Rust library


Hi all, from what I can find for now, most examples describe how to compile a binary crate to wasm. And I wonder if it’s possible to compile a library into wasm and make it accessible to JavaScript.

There’s an example I can find here, but I’m not sure how to do it with cargo …

And one step more, how can we expose Rust struct and struct methods to JavaScript? Is it possible?