Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a8090be

Browse files
James Munnsyoshuawuyts
James Munns
authored andcommitted
Fix book to use futures_channel and futures_util, re-enable testing (#172)
* Fix book to use futures_channel and futures_util, re-enable testing * Make dev dependencies for the book explicit
1 parent 7d635b3 commit a8090be

File tree

8 files changed

+48
-39
lines changed

8 files changed

+48
-39
lines changed

‎.travis.yml‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ matrix:
3535
script:
3636
- cargo doc --features docs
3737

38-
# TODO(yoshuawuyts): re-enable mdbook
39-
# - name: book
40-
# rust: nightly
41-
# os: linux
42-
# before_script:
43-
# - test -x $HOME/.cargo/bin/mdbook || ./ci/install-mdbook.sh
44-
# - cargo build # to find 'extern crate async_std' by `mdbook test`
45-
# script:
46-
# - mdbook build docs
47-
# - mdbook test -L ./target/debug/deps docs
38+
- name: book
39+
rust: nightly
40+
os: linux
41+
before_script:
42+
- test -x $HOME/.cargo/bin/mdbook || ./ci/install-mdbook.sh
43+
- cargo build # to find 'extern crate async_std' by `mdbook test`
44+
script:
45+
- mdbook build docs
46+
- mdbook test -L ./target/debug/deps docs
4847

4948
script:
5049
- cargo check --features unstable --all --benches --bins --examples --tests

‎Cargo.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ femme = "1.2.0"
4444
surf = "1.0.2"
4545
tempdir = "0.3.7"
4646

47+
# These are used by the book for examples
48+
futures-channel-preview = "0.3.0-alpha.18"
49+
futures-util-preview = "0.3.0-alpha.18"
50+
4751
[dev-dependencies.futures-preview]
4852
version = "0.3.0-alpha.18"
4953
features = ["std", "nightly", "async-await"]

‎docs/src/tutorial/all_together.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ At this point, we only need to start the broker to get a fully-functioning (in t
44

55
```rust,edition2018
66
# extern crate async_std;
7-
# extern crate futures;
7+
# extern crate futures_channel;
8+
# extern crate futures_util;
89
use async_std::{
910
io::{self, BufReader},
1011
net::{TcpListener, TcpStream, ToSocketAddrs},
1112
prelude::*,
1213
task,
1314
};
14-
use futures::{
15-
channel::mpsc,
16-
SinkExt,
17-
};
15+
use futures_channel::mpsc;
16+
use futures_util::SinkExt;
1817
use std::{
1918
collections::hash_map::{HashMap, Entry},
2019
sync::Arc,

‎docs/src/tutorial/clean_shutdown.md‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ Let's add waiting to the server:
2222

2323
```rust,edition2018
2424
# extern crate async_std;
25-
# extern crate futures;
25+
# extern crate futures_channel;
26+
# extern crate futures_util;
2627
# use async_std::{
2728
# io::{self, BufReader},
2829
# net::{TcpListener, TcpStream, ToSocketAddrs},
2930
# prelude::*,
3031
# task,
3132
# };
32-
# use futures::{
33-
# channel::mpsc,
34-
# SinkExt,
35-
# };
33+
# use futures_channel::mpsc;
34+
# use futures_util::SinkExt;
3635
# use std::{
3736
# collections::hash_map::{HashMap, Entry},
3837
# sync::Arc,
@@ -156,17 +155,16 @@ And to the broker:
156155

157156
```rust,edition2018
158157
# extern crate async_std;
159-
# extern crate futures;
158+
# extern crate futures_channel;
159+
# extern crate futures_util;
160160
# use async_std::{
161161
# io::{self, BufReader},
162162
# net::{TcpListener, TcpStream, ToSocketAddrs},
163163
# prelude::*,
164164
# task,
165165
# };
166-
# use futures::{
167-
# channel::mpsc,
168-
# SinkExt,
169-
# };
166+
# use futures_channel::mpsc;
167+
# use futures_util::SinkExt;
170168
# use std::{
171169
# collections::hash_map::{HashMap, Entry},
172170
# sync::Arc,

‎docs/src/tutorial/connecting_readers_and_writers.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ The order of events "Bob sends message to Alice" and "Alice joins" is determined
1212

1313
```rust,edition2018
1414
# extern crate async_std;
15-
# extern crate futures;
15+
# extern crate futures_channel;
16+
# extern crate futures_util;
1617
# use async_std::{
1718
# io::{Write},
1819
# net::TcpStream,
1920
# prelude::{Future, Stream},
2021
# task,
2122
# };
22-
# use futures::channel::mpsc;
23-
# use futures::sink::SinkExt;
23+
# use futures_channel::mpsc;
24+
# use futures_util::sink::SinkExt;
2425
# use std::sync::Arc;
2526
#
2627
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

‎docs/src/tutorial/handling_disconnection.md‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ First, let's add a shutdown channel to the `client`:
1919

2020
```rust,edition2018
2121
# extern crate async_std;
22-
# extern crate futures;
22+
# extern crate futures_channel;
23+
# extern crate futures_util;
2324
# use async_std::net::TcpStream;
24-
# use futures::{channel::mpsc, SinkExt};
25+
# use futures_channel::mpsc;
26+
# use futures_util::SinkExt;
2527
# use std::sync::Arc;
2628
#
2729
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
@@ -68,9 +70,11 @@ We use the `select` macro for this purpose:
6870

6971
```rust,edition2018
7072
# extern crate async_std;
71-
# extern crate futures;
73+
# extern crate futures_channel;
74+
# extern crate futures_util;
7275
# use async_std::{io::Write, net::TcpStream};
73-
use futures::{channel::mpsc, select, FutureExt, StreamExt};
76+
use futures_channel::mpsc;
77+
use futures_util::{select, FutureExt, StreamExt};
7478
# use std::sync::Arc;
7579
7680
# type Receiver<T> = mpsc::UnboundedReceiver<T>;
@@ -118,15 +122,18 @@ The final code looks like this:
118122

119123
```rust,edition2018
120124
# extern crate async_std;
121-
# extern crate futures;
125+
# extern crate futures_channel;
126+
# extern crate futures_util;
122127
use async_std::{
123128
io::{BufReader, BufRead, Write},
124129
net::{TcpListener, TcpStream, ToSocketAddrs},
125130
task,
126131
};
127-
use futures::{channel::mpsc, future::Future, select, FutureExt, SinkExt, StreamExt};
132+
use futures_channel::mpsc;
133+
use futures_util::{select, FutureExt, SinkExt, StreamExt};
128134
use std::{
129135
collections::hash_map::{Entry, HashMap},
136+
future::Future,
130137
sync::Arc,
131138
};
132139

‎docs/src/tutorial/implementing_a_client.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ With async, we can just use the `select!` macro.
1616

1717
```rust,edition2018
1818
# extern crate async_std;
19-
# extern crate futures;
19+
# extern crate futures_util;
2020
use async_std::{
2121
io::{stdin, BufRead, BufReader, Write},
2222
net::{TcpStream, ToSocketAddrs},
2323
task,
2424
};
25-
use futures::{select, FutureExt, StreamExt};
25+
use futures_util::{select, FutureExt, StreamExt};
2626
2727
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
2828

‎docs/src/tutorial/sending_messages.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ if Alice and Charley send two messages to Bob at the same time, Bob will see the
1313

1414
```rust,edition2018
1515
# extern crate async_std;
16-
# extern crate futures;
16+
# extern crate futures_channel;
17+
# extern crate futures_util;
1718
# use async_std::{
1819
# io::Write,
1920
# net::TcpStream,
2021
# prelude::Stream,
2122
# };
22-
use futures::channel::mpsc; // 1
23-
use futures::sink::SinkExt;
23+
use futures_channel::mpsc; // 1
24+
use futures_util::sink::SinkExt;
2425
use std::sync::Arc;
2526
2627
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /