Skip to content

Commit c34e0f8

Browse files
author
Stjepan Glavina
authored
Update futures to 0.3 (async-rs#463)
* Update futures to 0.3 * Fix a search-and-replace error * Fix imports in tests * Fix an import
1 parent 93b01e3 commit c34e0f8

9 files changed

+34
-46
lines changed

Cargo.toml

+3-7
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ broadcaster = { version = "0.2.6", optional = true, default-features = false, fe
3232
crossbeam-channel = "0.3.9"
3333
crossbeam-deque = "0.7.1"
3434
crossbeam-utils = "0.6.6"
35-
futures-core-preview = "=0.3.0-alpha.19"
36-
futures-io-preview = "=0.3.0-alpha.19"
35+
futures-core = "0.3.0"
36+
futures-io = "0.3.0"
3737
futures-timer = "1.0.2"
3838
kv-log-macro = "1.0.4"
3939
log = { version = "0.4.8", features = ["kv_unstable"] }
@@ -51,11 +51,7 @@ femme = "1.2.0"
5151
rand = "0.7.2"
5252
# surf = "1.0.2"
5353
tempdir = "0.3.7"
54-
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
55-
56-
# These are used by the book for examples
57-
futures-channel-preview = "=0.3.0-alpha.19"
58-
futures-util-preview = "=0.3.0-alpha.19"
54+
futures = "0.3.0"
5955

6056
[[test]]
6157
name = "stream"

docs/src/tutorial/all_together.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ 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_channel;
8-
# extern crate futures_util;
7+
# extern crate futures;
98
use async_std::{
109
io::{self, BufReader},
1110
net::{TcpListener, TcpStream, ToSocketAddrs},
1211
prelude::*,
1312
task,
1413
};
15-
use futures_channel::mpsc;
16-
use futures_util::SinkExt;
14+
use futures::channel::mpsc;
15+
use futures::SinkExt;
1716
use std::{
1817
collections::hash_map::{HashMap, Entry},
1918
sync::Arc,

docs/src/tutorial/clean_shutdown.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ Let's add waiting to the server:
2222

2323
```rust,edition2018
2424
# extern crate async_std;
25-
# extern crate futures_channel;
26-
# extern crate futures_util;
25+
# extern crate futures;
2726
# use async_std::{
2827
# io::{self, BufReader},
2928
# net::{TcpListener, TcpStream, ToSocketAddrs},
3029
# prelude::*,
3130
# task,
3231
# };
33-
# use futures_channel::mpsc;
34-
# use futures_util::SinkExt;
32+
# use futures::channel::mpsc;
33+
# use futures::SinkExt;
3534
# use std::{
3635
# collections::hash_map::{HashMap, Entry},
3736
# sync::Arc,
@@ -156,16 +155,15 @@ And to the broker:
156155

157156
```rust,edition2018
158157
# extern crate async_std;
159-
# extern crate futures_channel;
160-
# extern crate futures_util;
158+
# extern crate futures;
161159
# use async_std::{
162160
# io::{self, BufReader},
163161
# net::{TcpListener, TcpStream, ToSocketAddrs},
164162
# prelude::*,
165163
# task,
166164
# };
167-
# use futures_channel::mpsc;
168-
# use futures_util::SinkExt;
165+
# use futures::channel::mpsc;
166+
# use futures::SinkExt;
169167
# use std::{
170168
# collections::hash_map::{HashMap, Entry},
171169
# sync::Arc,

docs/src/tutorial/connecting_readers_and_writers.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ 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_channel;
16-
# extern crate futures_util;
15+
# extern crate futures;
1716
# use async_std::{
1817
# net::TcpStream,
1918
# prelude::*,
2019
# task,
2120
# };
22-
# use futures_channel::mpsc;
23-
# use futures_util::sink::SinkExt;
21+
# use futures::channel::mpsc;
22+
# use futures::sink::SinkExt;
2423
# use std::sync::Arc;
2524
#
2625
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

docs/src/tutorial/handling_disconnection.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ First, let's add a shutdown channel to the `connection_loop`:
1919

2020
```rust,edition2018
2121
# extern crate async_std;
22-
# extern crate futures_channel;
23-
# extern crate futures_util;
22+
# extern crate futures;
2423
# use async_std::net::TcpStream;
25-
# use futures_channel::mpsc;
26-
# use futures_util::SinkExt;
24+
# use futures::channel::mpsc;
25+
# use futures::SinkExt;
2726
# use std::sync::Arc;
2827
#
2928
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
@@ -70,11 +69,10 @@ We use the `select` macro for this purpose:
7069

7170
```rust,edition2018
7271
# extern crate async_std;
73-
# extern crate futures_channel;
74-
# extern crate futures_util;
72+
# extern crate futures;
7573
# use async_std::{net::TcpStream, prelude::*};
76-
use futures_channel::mpsc;
77-
use futures_util::{select, FutureExt};
74+
use futures::channel::mpsc;
75+
use futures::{select, FutureExt};
7876
# use std::sync::Arc;
7977
8078
# type Receiver<T> = mpsc::UnboundedReceiver<T>;
@@ -122,16 +120,15 @@ The final code looks like this:
122120

123121
```rust,edition2018
124122
# extern crate async_std;
125-
# extern crate futures_channel;
126-
# extern crate futures_util;
123+
# extern crate futures;
127124
use async_std::{
128125
io::BufReader,
129126
net::{TcpListener, TcpStream, ToSocketAddrs},
130127
prelude::*,
131128
task,
132129
};
133-
use futures_channel::mpsc;
134-
use futures_util::{select, FutureExt, SinkExt};
130+
use futures::channel::mpsc;
131+
use futures::{select, FutureExt, SinkExt};
135132
use std::{
136133
collections::hash_map::{Entry, HashMap},
137134
future::Future,

docs/src/tutorial/implementing_a_client.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ With async, we can just use the `select!` macro.
1616

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

docs/src/tutorial/sending_messages.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ 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_channel;
17-
# extern crate futures_util;
16+
# extern crate futures;
1817
# use async_std::{
1918
# net::TcpStream,
2019
# prelude::*,
2120
# };
22-
use futures_channel::mpsc; // 1
23-
use futures_util::sink::SinkExt;
21+
use futures::channel::mpsc; // 1
22+
use futures::sink::SinkExt;
2423
use std::sync::Arc;
2524
2625
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

src/path/path.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,9 @@ impl Path {
615615
/// ```no_run
616616
/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
617617
/// #
618-
/// use async_std::path::Path;
619618
/// use async_std::fs;
620-
/// use futures_util::stream::StreamExt;
619+
/// use async_std::path::Path;
620+
/// use async_std::prelude::*;
621621
///
622622
/// let path = Path::new("/laputa");
623623
/// let mut dir = fs::read_dir(&path).await.expect("read_dir call failed");

src/sync/barrier.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ impl BarrierWaitResult {
204204

205205
#[cfg(test)]
206206
mod test {
207-
use futures_channel::mpsc::unbounded;
208-
use futures_util::sink::SinkExt;
209-
use futures_util::stream::StreamExt;
207+
use futures::channel::mpsc::unbounded;
208+
use futures::sink::SinkExt;
209+
use futures::stream::StreamExt;
210210

211211
use crate::sync::{Arc, Barrier};
212212
use crate::task;

0 commit comments

Comments
 (0)