2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-03-01 07:39:40 +00:00

missing .await (#69)

* missing .await

* Update tasks.md
This commit is contained in:
Shady Khalifa 2019-08-18 09:50:34 +02:00 committed by Stjepan Glavina
parent 2ef1a762de
commit fd0b4d4cff

View file

@ -17,7 +17,7 @@ async fn read_file(path: &str) -> Result<String, io::Error> {
fn main() { fn main() {
let reader_task = task::spawn(async { let reader_task = task::spawn(async {
let result = read_file("data.csv"); let result = read_file("data.csv").await;
match result { match result {
Ok(s) => println!("{}", s), Ok(s) => println!("{}", s),
Err(e) => println!("Error reading file: {:?}", e) Err(e) => println!("Error reading file: {:?}", e)
@ -33,7 +33,7 @@ This asks the runtime baked into `async_std` to execute the code that reads a fi
```rust ```rust
async { async {
let result = read_file("data.csv"); let result = read_file("data.csv").await;
match result { match result {
Ok(s) => println!("{}", s), Ok(s) => println!("{}", s),
Err(e) => println!("Error reading file: {:?}", e) Err(e) => println!("Error reading file: {:?}", e)