I have 2 futures. I would like to combine them into one future that I can await. Specifically, when the combined future is awaited, I would like to first await the first future and then await the second future.
I do not need the return value of the first future, it can be ignored (insofar as it is not an error). But I do need the return value of the second future.
I can't find a simple way to combine the 2 futures. It looks like the only solution is to use an async closure?
Here's what I've researched & found so far:
-
Stack Overflow Answer 1
- This seems to be addressing a different problem and
iter_ok
doesn't seem to exist anymore?
- This seems to be addressing a different problem and
- There is join, but this polls the futures concurrently (which I guess should have the same end result, but seems less performant since I know I only need to poll the 2nd future after the first one has been completed).
-
and_then
seems like what I want, but it only works on awaited futures
The specific thing I'm trying to do is to create a future that encapsulates sending a request through a channel & then waiting for a single response.