3 ms·
Well, you can't use the `async` keyword version if you need the `Send` bound. Imo, Rust should introduce some syntax like `async(dyn+Send)` that desugars to `B
by Dagonfly 2y ago
Well, you can't use the `async` keyword version if you need the `Send` bound.
Imo, Rust should introduce some syntax like `async(dyn+Send)` that desugars to `Box<dyn Future<Output = bla> + Send>`. This solves most of the async wards if you don't care about heap allocation and perfect performance.
- ahahahahah 2y agoThat's partially not true. You can use a non-async form in the trait definition to require the Send bound and then the trait impls can use the async form. See https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d55f089dc3de8df08cf0fe5b2c8d0e2f https://play.rust-lang.org/?version=nightly&mode=debug&editi...
- Dagonfly 2y agoFair point. Though, the code in question was a trait definition.