Hacker News new | ask | show | jobs
by the_mitsuhiko 651 days ago
It's worth pointing out here for people not familiar with Rust, that this is the result of code generation by a third party crate to enable async methods on traits.
1 comments

Which isn't even needed anymore; now the compiler accepts it without any macros.
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.

That'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&editi...
Fair point. Though, the code in question was a trait definition.
The compiler only supports these for static dispatch, the above use case relies on dynamic dispatch.