await!() is best IMO

You might be wondering why anyone should care what I think about the await syntax or why my opinion matters. You shouldn’t, It doesn’t. Particularly because my syntax choice has nothing to do with await / async. But if you’re still curious keep reading!

Why await!()?

Simply because I want associated macros. Why do I want associated macros? Because I want to be able to have formatted prints in expect calls. The rust I dream of would allow this.

toml::from_str(&file_contents).expect!("{:?} contained valid toml data", path);

Instead of this

toml::from_str(&file_contents).unwrap_or_else(|e| {
        "expected that {:?} contained valid toml, error: {:?}",
        path, e

Right now you have to inline a format! call, which then makes clippy yell at you because it will always get invoked, so now you have to replace expect with an unwrap_or_else and if you still want to follow the expect pattern where you write down what invariant you expected was true that made it legal you no longer have that context, and if you’re OCD and want the message to look like the ones that expect formats for you, you have to go look up what exactly that is and include that too!

It bothers me! But I figure if we had associated macros we could easily add expect! to Result and Option and massage away one of my most insignificant annoyances. And I figure if await!() got stabilized more people would think about and ask for associated macros in general.


So yea, that’s why I want .await!() to be stabilized.