Skip to content

Commit 217e435

Browse files
author
Stjepan Glavina
committed
Fix more compilation errors in the book
1 parent f2ca3f3 commit 217e435

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

docs/src/concepts/futures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Note that this return value talks about the past. The past has a drawback: all d
6767
But we wanted to abstract over *computation* and let someone else choose how to run it. That's fundamentally incompatible with looking at the results of previous computation all the time. So, let's find a type that *describes* a computation without running it. Let's look at the function again:
6868

6969
```rust,edition2018
70-
# use std::{fs::File, io::{self, Read}};
70+
# use std::{fs::File, io, io::prelude::*};
7171
#
7272
fn read_file(path: &str) -> io::Result<String> {
7373
let mut file = File::open(path)?;

docs/src/tutorial/accept_loop.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Now we can write the server's accept loop:
2929
# extern crate async_std;
3030
# use async_std::{
3131
# net::{TcpListener, ToSocketAddrs},
32-
# prelude::Stream,
32+
# prelude::*,
3333
# };
3434
#
3535
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
@@ -66,7 +66,7 @@ Finally, let's add main:
6666
# extern crate async_std;
6767
# use async_std::{
6868
# net::{TcpListener, ToSocketAddrs},
69-
# prelude::Stream,
69+
# prelude::*,
7070
# task,
7171
# };
7272
#

docs/src/tutorial/connecting_readers_and_writers.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ The order of events "Bob sends message to Alice" and "Alice joins" is determined
1515
# extern crate futures_channel;
1616
# extern crate futures_util;
1717
# use async_std::{
18-
# io::{Write},
1918
# net::TcpStream,
20-
# prelude::{Future, Stream},
19+
# prelude::*,
2120
# task,
2221
# };
2322
# use futures_channel::mpsc;

docs/src/tutorial/handling_disconnection.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ We use the `select` macro for this purpose:
7272
# extern crate async_std;
7373
# extern crate futures_channel;
7474
# extern crate futures_util;
75-
# use async_std::{io::Write, net::TcpStream};
75+
# use async_std::{net::TcpStream, prelude::*};
7676
use futures_channel::mpsc;
7777
use futures_util::{select, FutureExt, StreamExt};
7878
# use std::sync::Arc;
@@ -125,8 +125,9 @@ The final code looks like this:
125125
# extern crate futures_channel;
126126
# extern crate futures_util;
127127
use async_std::{
128-
io::{BufReader, BufRead, Write},
128+
io::BufReader,
129129
net::{TcpListener, TcpStream, ToSocketAddrs},
130+
prelude::*,
130131
task,
131132
};
132133
use futures_channel::mpsc;

docs/src/tutorial/implementing_a_client.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ With async, we can just use the `select!` macro.
1818
# extern crate async_std;
1919
# extern crate futures_util;
2020
use async_std::{
21-
io::{stdin, BufRead, BufReader, Write},
21+
io::{stdin, BufReader},
2222
net::{TcpStream, ToSocketAddrs},
23+
prelude::*,
2324
task,
2425
};
2526
use futures_util::{select, FutureExt, StreamExt};

docs/src/tutorial/receiving_messages.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ We need to:
1010
```rust,edition2018
1111
# extern crate async_std;
1212
# use async_std::{
13-
# io::{BufRead, BufReader},
13+
# io::BufReader,
1414
# net::{TcpListener, TcpStream, ToSocketAddrs},
15-
# prelude::Stream,
15+
# prelude::*,
1616
# task,
1717
# };
1818
#
@@ -75,9 +75,9 @@ We can "fix" it by waiting for the task to be joined, like this:
7575
# #![feature(async_closure)]
7676
# extern crate async_std;
7777
# use async_std::{
78-
# io::{BufRead, BufReader},
78+
# io::BufReader,
7979
# net::{TcpListener, TcpStream, ToSocketAddrs},
80-
# prelude::Stream,
80+
# prelude::*,
8181
# task,
8282
# };
8383
#
@@ -125,7 +125,7 @@ So let's use a helper function for this:
125125
# extern crate async_std;
126126
# use async_std::{
127127
# io,
128-
# prelude::Future,
128+
# prelude::*,
129129
# task,
130130
# };
131131
fn spawn_and_log_error<F>(fut: F) -> task::JoinHandle<()>

docs/src/tutorial/sending_messages.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ if Alice and Charley send two messages to Bob at the same time, Bob will see the
1616
# extern crate futures_channel;
1717
# extern crate futures_util;
1818
# use async_std::{
19-
# io::Write,
2019
# net::TcpStream,
21-
# prelude::Stream,
20+
# prelude::*,
2221
# };
2322
use futures_channel::mpsc; // 1
2423
use futures_util::sink::SinkExt;

0 commit comments

Comments
 (0)