programmerRaj
programmerRaj

Reputation: 2098

How to await multiple Rust futures in parallel, and stop as soon as one of them outputs Err

I am using tokio::join. Sometimes one of the futures completes with Err but the other future doesn't complete. I want the combined future to complete as soon as the first future fails, similar to JavaScript's Promise.all.

Upvotes: 1

Views: 120

Answers (1)

programmerRaj
programmerRaj

Reputation: 2098

As I was writing this question I came across tokio::try-join, which does exactly what I needed.

Upvotes: 2

Related Questions