diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 3ed08435..3f462613 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -11,6 +11,7 @@ - [Reference](./reference/index.md) - [Passing Rust Closures to JS](./reference/passing-rust-closures-to-js.md) - [Receiving JS Closures in Rust](./reference/receiving-js-closures-in-rust.md) + - [`Promise`s and `Future`s](./reference/js-promises-and-rust-futures.md) - [No ES Modules](./reference/no-esm.md) - [Arbitrary Data with Serde](./reference/arbitrary-data-with-serde.md) - [Command Line Interface](./reference/cli.md) diff --git a/guide/src/reference/js-promises-and-rust-futures.md b/guide/src/reference/js-promises-and-rust-futures.md new file mode 100644 index 00000000..e24ebc90 --- /dev/null +++ b/guide/src/reference/js-promises-and-rust-futures.md @@ -0,0 +1,15 @@ +# Converting Between JavaScript `Promise`s and Rust `Future`s + +The `wasm-bindgen-futures` crate bridges the gap between JavaScript `Promise`s +and Rust `Future`s. Its `JsFuture` type provides conversion from a JavaScript +`Promise` into a Rust `Future`, and its `future_to_promise` function converts a +Rust `Future` into a JavaScript `Promise` and schedules it to be driven to +completion. + +Learn more: + +* [`wasm_bindgen_futures` on crates.io][crate] +* [`wasm-bindgen-futures` API documentation and example usage][docs] + +[crate]: https://crates.io/crates/wasm-bindgen-futures +[docs]: https://rustwasm.github.io/wasm-bindgen/api/wasm_bindgen_futures/