This repository contains example(s) of an asynchronous iterator implemented using various specific approaches:
- Using the
poll_nextinterface - Using
async gen - Using the
async fn next(AFIT) interface - Using
async genwithout borrows acrossyieldpoints (the proposed lowering-to-AFITasync genblocks) - Using lending AFIT (if it makes sense)
- Using
async genwith lending (if it makes sense)
Lending means yielding references that point into the iterator itself.
The goal is to compare the ergonomics (potentially also efficiency) properties of these approaches, and show how they can be used to write async iterators that might occur "in the wild".
It's very much possible that the implementations are not as elegant as possible, possible improvements are welcome :)
Currently implemented examples:
These interfaces have been described in detail in several blog posts by WithoutBoats and Yoshua Wuyts.