Wasm-bindgen

wasm-bindgen is a crate that was developed by the rust-wasm team on GitHub. It allows Rust code to call JavaScript code and vice versa. Based on this library, other higher-level libraries have been built, such as the web-sys crate and the js-sys crate.

JavaScript by itself is what is defined by the ECMA standard, but the standard does not specify how it works on the web. JavaScript can support many hosts and the web happens to be one of them. The web-sys crate gives access to all of the JavaScript APIs on the web, that is, DOM APIs such as Window, Navigator, EventListener, and so on. The js-sys crate provides all of the base JavaScript objects that are specified in the ECMA standard specification, that is, functions, objects, ...

Get Mastering Rust - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.