Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: