A Rust library and CLI tool for high-level interoperability between WebAssembly modules and JavaScript.
wasm-bindgen is a Rust library and command-line tool that facilitates high-level interactions between WebAssembly (Wasm) modules and JavaScript. It allows developers to seamlessly import JavaScript functions into Rust and export Rust functions to JavaScript, enabling type-safe interoperability for web applications built with Rust and WebAssembly.
Rust developers building web applications or libraries that need to run in the browser via WebAssembly and interact with JavaScript APIs, DOM, or existing web ecosystems.
Developers choose wasm-bindgen for its lightweight, type-safe bindings that minimize overhead, its alignment with future WebAssembly standards like ECMAScript module integration, and its design for high-performance DOM access without unnecessary JavaScript shims.
Facilitating high-level interactions between Wasm modules and JavaScript
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Only generates glue code for specific JavaScript imports and Rust exports used, minimizing final bundle size and overhead, as emphasized in the README's features section.
Allows WebAssembly modules to be imported like standard JavaScript modules, ensuring future compatibility with WebAssembly-ES module integration standards.
Provides statically type-checked interactions between Rust and JavaScript, reducing runtime errors and enhancing code reliability through explicit bindings.
Built with the Web IDL bindings proposal in mind, aiming for direct, fast DOM access without JavaScript shims, promising better long-term performance.
Requires installing wasm-bindgen-cli, managing Rust versions, and integrating with build tools, adding overhead compared to pure JavaScript development workflows.
The Rust and WebAssembly ecosystem, including libraries like web-sys, is still developing, leading to potential functionality gaps and instability in third-party support.
For simple interop or lightweight operations, the overhead of WebAssembly compilation and binding generation might negate performance benefits, making pure JavaScript more efficient.
Designed around future web standards like Web IDL bindings, current implementations may rely on shims or have limitations until these standards are widely adopted, as noted in the README.