pub fn future_to_promise<F>(future: F) -> PromiseAvailable on not (WebAssembly and crate feature
std and panic=unwind).Expand description
Converts a Rust Future into a JavaScript Promise.
This function will take any future in Rust and schedule it to be executed,
returning a JavaScript Promise which can then be passed to JavaScript.
The future must be 'static because it will be scheduled to run in the
background and cannot contain any stack references.
The returned Promise will be resolved or rejected when the future
completes, depending on whether it finishes with Ok or Err.
§Panics
Note that in Wasm panics are currently translated to aborts, but “abort” in this case means that a JavaScript exception is thrown. The Wasm module is still usable (likely erroneously) after Rust panics.