Aha, thank you for clarifying that for me. Indeed, the following compiles just fine:
- Using
BoxFuture
: playground. - Using some trait indirection and a non-closure
fn
: playground.
I also attempted a solution using type_alias_impl_trait
, but bumped into Unification fails when type alias impl trait is used in non-return position · Issue #64445 · rust-lang/rust · GitHub, I think (playground).
This is the second time you've pulled me out of a fight with the compiler, so thanks again!