HH\AsyncIterator

Allows for the iteration over the values provided by an async function

If an async function returns an AsyncIterator<T>, then you can iterate over the T values returned from that function.

async function countdown(int $start): AsyncIterator<int> { ... }

async function use_countdown(): Awaitable<void> {
  $async_iter = countdown(100);
  foreach ($async_iter await as $value) { ... }
}

Interface Synopsis

namespace HH {
interface AsyncIterator  {...}
}