async-book
async-book copied to clipboard
Add Async Recursion Macro to Workarounds
This may not be something you want in the book, but there is a nifty macro crate for automatically transforming async functions to return boxed futures that could be useful to people.
I noticed the other example was in a separate file, but this is a super small example so I just inlined it. I can change it if you like.
I wonder if this is no longer necessary because impl trait recursion was allowed some time ago.
Looks like a simple recursive async function still fails ( playground ).
Ah, thanks. And it is impressive that the compiler's diagnosis mentions async_recursion crate.
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion