Yesterday, the Rust and Web Assembly community made two announcements. Firstly, it released the ‘wasm-bindgen’ 0.2.16 version and second, it published the first release of ‘wasm-bindgen-futures’.
What’s new in wasm-bindgen 0.2.16
- Added the wasm_bindgen::JsCast trait, as described in RFC #2.
- Added reference documentation to the guide for every #[wasm_bindgen] attribute and how it affects the generated bindings.
Changes in this version 0.2.16
- Restructured the guide’s documentation on passing JS closures to Rust, and Rust closures to JS. Also improved the guide’s documentation on using serde to serialize complex data to JsValue and deserialize JsValues back into complex data.
- Static methods are now always bound to their JS class, as is required for Promise’s static methods.
The newly released wasm-bindgen-futures
The two main interfaces in this crate are:
The JsFuture is constructed with a Promise and can then be used as a Future<Item = JsValue, Error = JsValue>. This Rust future will resolve or reject with the value coming out of the Promise