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

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.