HH\AsyncKeyedIterator
Allows for the iteration over the keys and values provided by an async
function
If an async
function returns an AsyncIterator<Tk,
Tv>
, then you can
iterate over the Tk
and Tv
values returned from that function.
async function countdown(int $start): AsyncIterator<int, string> { ... }
async function use_countdown(): Awaitable<void> {
$async_iter = countdown(100);
foreach ($async_gen await as $num => $str) { ... }
}
Guides
Interface Synopsis
namespace HH;
interface AsyncKeyedIterator implements AsyncIterator<Tv> {...}
Public Methods
->next(): Awaitable<?(Tk, Tv)>
Move the async iterator to the nextAwaitable
position