Async Traits Can Be Directly Backed by Manual Future Impls

Introduction There’s a fun little tidbit that most people don’t seem to be aware of when writing async functions in traits (AFITs) and that is: they allow you to directly return futures from methods. Sounds confusing? Let me illustrate what I mean with a simple example. Assume we have an a trait AsyncIterator which has an async fn next method that is defined as follows: rust trait AsyncIterator {…