2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-30 01:05:31 +00:00

Clarify async fn return type

This commit is contained in:
Brad Gibson 2019-08-17 19:53:12 -07:00 committed by GitHub
parent 2ef1a762de
commit 7f9dae9e5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,7 +102,7 @@ While the `Future` trait has existed in Rust for a while, it was inconvenient to
Amazingly little difference, right? All we did is label the function `async` and insert 2 special commands: `.await`.
This function sets up a deferred computation. When this function is called, it will produce a `Future<Output=String>` instead of immediately returning a String. (Or, more precisely, generate a type for you that implements `Future<Output=String>`.)
This function sets up a deferred computation. When this function is called, it will produce a `Future<Output=Result<String, io::Error>>` instead of immediately returning a `Result<String, io::Error>`. (Or, more precisely, generate a type for you that implements `Future<Output=Result<String, io::Error>>`.)
## What does `.await` do?