4 ms·
It's coming! https://blog.rust-lang.org/inside-rust/2022/11/17/async-fn-in-trait-nightly.html https://blog.rust-lang.org/inside-rust/2022/11/17/async-fn-i...
by tipsytoad 4y ago
It's coming!
https://blog.rust-lang.org/inside-rust/2022/11/17/async-fn-in-trait-nightly.html https://blog.rust-lang.org/inside-rust/2022/11/17/async-fn-i...
Although I'm still not sure how they return the unsized Future without the whole pin box method
- SpaghettiCthulu 4y agoMy understanding is that `async fn` in a trait is desugared to `fn() -> impl Future` just like it would be anywhere else, so there's no unsized types involved.
- pitaj 4y agoIt's actually desugared to a generic associated type: trait Foo { type bar_Returns<'s>: Future<Output = Result<u64, ()>> where Self: 's; fn bar<'s>(&'s self) -> Self::bar_Returns<'s>; }