Fix imports in the book

staging
Stjepan Glavina 5 years ago
parent 1fa196812a
commit a97d26ca13

@ -112,8 +112,7 @@ While the `Future` trait has existed in Rust for a while, it was inconvenient to
```rust,edition2018 ```rust,edition2018
# extern crate async_std; # extern crate async_std;
# use async_std::{fs::File, io::Read}; # use async_std::{fs::File, io, prelude::*};
# use std::io;
# #
async fn read_file(path: &str) -> Result<String, io::Error> { async fn read_file(path: &str) -> Result<String, io::Error> {
let mut file = File::open(path).await?; let mut file = File::open(path).await?;

@ -6,7 +6,7 @@ In `async-std`, the [`tasks`][tasks] module is responsible for this. The simples
```rust,edition2018 ```rust,edition2018
# extern crate async_std; # extern crate async_std;
use async_std::{io, task, fs::File, io::Read}; use async_std::{fs::File, io, prelude::*, task};
async fn read_file(path: &str) -> Result<String, io::Error> { async fn read_file(path: &str) -> Result<String, io::Error> {
let mut file = File::open(path).await?; let mut file = File::open(path).await?;
@ -33,8 +33,7 @@ This asks the runtime baked into `async_std` to execute the code that reads a fi
```rust,edition2018 ```rust,edition2018
# extern crate async_std; # extern crate async_std;
# use async_std::{fs::File, io::Read, task}; # use async_std::{fs::File, prelude::*, task};
# use std::io;
# #
# async fn read_file(path: &str) -> Result<String, io::Error> { # async fn read_file(path: &str) -> Result<String, io::Error> {
# let mut file = File::open(path).await?; # let mut file = File::open(path).await?;

Loading…
Cancel
Save