async-book icon indicating copy to clipboard operation
async-book copied to clipboard

Add Async Recursion Macro to Workarounds

Open zicklag opened this issue 5 years ago • 3 comments

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.

zicklag avatar Mar 27 '20 22:03 zicklag

I wonder if this is no longer necessary because impl trait recursion was allowed some time ago.

taiki-e avatar Jul 30 '22 11:07 taiki-e

Looks like a simple recursive async function still fails ( playground ).

zicklag avatar Jul 30 '22 14:07 zicklag

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

taiki-e avatar Jul 30 '22 14:07 taiki-e