I have a Vec<String> and would like to map each element of this Vec to an async function. The async function doesn't return anything, so I do not care about the output. What is the fastest way to execute these async function calls? If I use a naive for-loop, I believe they execute in series, which is not desired. I found futures::future::join_all and tokio::spawn but am not sure if this is the way I should be approaching the problem. Here is what I have so far:
use futures::future::join_all;
async fn do_something_async(param: String) -> () {
...
}
#[tokio::main]
async fn main() {
let foo: Vec<String> ... ;
join_all(
foo.iter().map(|el| {do_something_async(el)})
).await;
}