Summary
In this chapter, we saw how wasm-bindgen
makes it easy to share complex objects between JavaScript and Rust. The annotations make it easy to mark a function to export/import between JavaScript and WebAssembly. We also saw how js-sys and web-sys Cargo make it easier to call JavaScript and web APIs inside Rust code easily.
In the next chapter, we will see how to optimize the generated WebAssembly module in Rust.