35
Was async fn a mistake? (seanmonstar.com)
you are viewing a single comment's thread
view the rest of the comments
[-] runiq@feddit.de 7 points 1 year ago* (last edited 1 year ago)
fn call(&self, req: Request) -> Future = async {
    // ...
}

Honestly, that's not much better than the already working (but admittedly weird looking)

fn call(&self, req: Request) -> impl Future { async {
    // ...
}}

But I do agree with the gist of the article. Time to get out the 🍿 and hop on over to r/rust.

Edit: Lemmy's markdown parser doesn't appear to like ampersands in code fences, or angle brackets

Edit2: After reading u/cramertj's response, it looks like lifetimes would complicate what I wrote above significantly. So… yeah, thanks for all the work, Sean and Tyler, it's appreciated. 🙂

this post was submitted on 29 Sep 2023
35 points (97.3% liked)

Rust

5974 readers
52 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS