An async fn call is a task, not its result. Using it where the result is expected (in
arithmetic, as an argument, as a return value) needs an await first.
Wrong#
async fn get(): int = 1
fn main() { print(get() + 1) }Fixed#
async fn get(): int = 1
fn main() { print(await get() + 1) }Common causes#
- A forgotten
await. - A function that became
asyncafter its callers were written.