Await Syntax Discussion Summary

One particular examples from https://github.com/inejge/await-syntax/blob/master/bin/wlan/wlantool/src/main.rs converted to use .await (replaced with .match for highlighting) (we can bikeshed formatting some other time):

opts::ClientCmd::Disconnect { iface_id } => {
    get_client_sme(wlan_svc, iface_id).match?
        .disconnect().match
        .map_err(|e| format_err!("error sending disconnect request: {}", e))
}

I find this quite readable and it seems quite ergonomic to write as well, especially when combined with “the power of the dot”. Meanwhile, await? didn’t seem nearly as useful as one might expect.

(I agree completely with @scottmcm that there need not be a second .await for chaining to be useful)

I counted 17 opportunities to chain, not 4.

That there were 4 times where .await could be chained in the same statement was quite surprising to me actually. I expected it to be far rarer than this, but 4 out of 40 in such a small bit of code is in my view significant.

14 Likes