Rust doesn't actually follow its Golden Rule
(when it comes to async functions)
A couple of days ago, Steve Klabnik published an article discussing Rust's Golden Rule, arguing that Rust's function signatures provide a clear contract that doesn't depend on the function's contents, which aids reasoning about the code. In particular, function signatures are never inferred.
However, the Rust language has evolved so that it violates this Golden Rule.
impl Trait return types by themselves are fine,
they combine with auto-traits such as
Send in an unfortunate manner.
This is a noticeable limitation when it comes to writing async Rust code.
- no newer years. Subscribe to Atom feed. Get notified when more articles are posted.
- previous year: 2020