How to use `tokio::select!` to wait on a vector of `tokio::task::JoinHandle<()>`

I have a vector of tokio::task::JoinHandle<()>, which represents an array of tasks running in parallel, I want to exit the whole process if anyone of them finishes.

How to use tokio::select! to wait on a vector of tokio::task::JoinHandle<()>? I tried multiple times but didn't find a way to do it. Help is needed, thanks!

You can't use tokio::select! for that. Instead, you can use JoinSet or FuturesUnordered.

Nice, thanks a lot!