title: How to wait for a list of async function calls in Rust?
body: <p>I have a list of <code>async</code> functions that I want to execute concurrently and then wait for all them to finish. The working code I have right now is:</p>
  <pre><code>async fn start_consumers(&amp;self) {
      for consumer in &amp;self.consumers {
          consumer.consume().await;
      }
  }
  </code></pre>
  <p>This is not quite accurate as the functions are executed serially. I am looking for something like <a href="https://docs.rs/async-std/0.99.12/async_std/future/macro.join.html" rel="nofollow noreferrer"><code>join!</code></a>, but which works on a dynamic vector. With that I should be able to write something like:</p>
  <pre><code>async fn start_consumers(&amp;self) {
      let mut v = Vec::new();
      for consumer in &amp;self.consumers {
          consumer.consume();
      }
      join!(v);
  }
  </code></pre>
  <p>Right now <code>join!</code> supports only tuples. I am looking for an alternative for that. Something similar to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all" rel="nofollow noreferrer"><code>Promise.all()</code></a> in JavaScript.</p>