Is there a way to use `?` operator with `await!`?


#1

I’m rewriting a code I wrote with Tokio to use async/await using async-await-preview feature in Tokio 0.1.25. I know that a form of using ? with await is debated and there’s no consensus yet, but I was wondering if there’s any way of using it currently? I’m not very concerned with the need to change the code later when the final form of the syntax is decided because I’m using it only for my hobby apps, thus I’m fine with changing and/or rewriting it later.

I’m sure it would be possible to write my own macro as a wrapper on Tokio’s await (which is a wrapper as well as far as I know :D), but I haven’t got to macros yet, so I might try it after I learn more Rust.


#2

OK, that’s kind of embarassing, but it seems that it works out of the box. I’ve been iterating over this code a lot and I was trying to use 0.3 futures and various other things, so I guess I was seeing some other error that I misread as a problem with ? operator?

Maybe at least someone will find it helpful to have an example for async web calls, here’s the code