Chaining on a JsFuture

I have:

x: JsFuture; // https://rustwasm.github.io/wasm-bindgen/reference/js-promises-and-rust-futures.html
f: fn (JsValue) -> T;

is there a way to chain the two to get an object of type Future<T> ?

Basically I want to await on the x, apply f, and return.

How about this?

let fut = async move { f(x.await) };
1 Like