Update futures to 0.3 (#463)

* Update futures to 0.3

* Fix a search-and-replace error

* Fix imports in tests

* Fix an import
poc-serde-support
Stjepan Glavina 5 years ago committed by GitHub
parent 93b01e36ed
commit c34e0f8a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,8 +32,8 @@ broadcaster = { version = "0.2.6", optional = true, default-features = false, fe
crossbeam-channel = "0.3.9"
crossbeam-deque = "0.7.1"
crossbeam-utils = "0.6.6"
futures-core-preview = "=0.3.0-alpha.19"
futures-io-preview = "=0.3.0-alpha.19"
futures-core = "0.3.0"
futures-io = "0.3.0"
futures-timer = "1.0.2"
kv-log-macro = "1.0.4"
log = { version = "0.4.8", features = ["kv_unstable"] }
@ -51,11 +51,7 @@ femme = "1.2.0"
rand = "0.7.2"
# surf = "1.0.2"
tempdir = "0.3.7"
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
# These are used by the book for examples
futures-channel-preview = "=0.3.0-alpha.19"
futures-util-preview = "=0.3.0-alpha.19"
futures = "0.3.0"
[[test]]
name = "stream"

@ -4,16 +4,15 @@ At this point, we only need to start the broker to get a fully-functioning (in t
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
use async_std::{
io::{self, BufReader},
net::{TcpListener, TcpStream, ToSocketAddrs},
prelude::*,
task,
};
use futures_channel::mpsc;
use futures_util::SinkExt;
use futures::channel::mpsc;
use futures::SinkExt;
use std::{
collections::hash_map::{HashMap, Entry},
sync::Arc,

@ -22,16 +22,15 @@ Let's add waiting to the server:
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
# use async_std::{
# io::{self, BufReader},
# net::{TcpListener, TcpStream, ToSocketAddrs},
# prelude::*,
# task,
# };
# use futures_channel::mpsc;
# use futures_util::SinkExt;
# use futures::channel::mpsc;
# use futures::SinkExt;
# use std::{
# collections::hash_map::{HashMap, Entry},
# sync::Arc,
@ -156,16 +155,15 @@ And to the broker:
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
# use async_std::{
# io::{self, BufReader},
# net::{TcpListener, TcpStream, ToSocketAddrs},
# prelude::*,
# task,
# };
# use futures_channel::mpsc;
# use futures_util::SinkExt;
# use futures::channel::mpsc;
# use futures::SinkExt;
# use std::{
# collections::hash_map::{HashMap, Entry},
# sync::Arc,

@ -12,15 +12,14 @@ The order of events "Bob sends message to Alice" and "Alice joins" is determined
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
# use async_std::{
# net::TcpStream,
# prelude::*,
# task,
# };
# use futures_channel::mpsc;
# use futures_util::sink::SinkExt;
# use futures::channel::mpsc;
# use futures::sink::SinkExt;
# use std::sync::Arc;
#
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

@ -19,11 +19,10 @@ First, let's add a shutdown channel to the `connection_loop`:
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
# use async_std::net::TcpStream;
# use futures_channel::mpsc;
# use futures_util::SinkExt;
# use futures::channel::mpsc;
# use futures::SinkExt;
# use std::sync::Arc;
#
# 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:
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
# use async_std::{net::TcpStream, prelude::*};
use futures_channel::mpsc;
use futures_util::{select, FutureExt};
use futures::channel::mpsc;
use futures::{select, FutureExt};
# use std::sync::Arc;
# type Receiver<T> = mpsc::UnboundedReceiver<T>;
@ -122,16 +120,15 @@ The final code looks like this:
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
use async_std::{
io::BufReader,
net::{TcpListener, TcpStream, ToSocketAddrs},
prelude::*,
task,
};
use futures_channel::mpsc;
use futures_util::{select, FutureExt, SinkExt};
use futures::channel::mpsc;
use futures::{select, FutureExt, SinkExt};
use std::{
collections::hash_map::{Entry, HashMap},
future::Future,

@ -16,14 +16,14 @@ With async, we can just use the `select!` macro.
```rust,edition2018
# extern crate async_std;
# extern crate futures_util;
# extern crate futures;
use async_std::{
io::{stdin, BufReader},
net::{TcpStream, ToSocketAddrs},
prelude::*,
task,
};
use futures_util::{select, FutureExt};
use futures::{select, FutureExt};
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

@ -13,14 +13,13 @@ if Alice and Charley send two messages to Bob at the same time, Bob will see the
```rust,edition2018
# extern crate async_std;
# extern crate futures_channel;
# extern crate futures_util;
# extern crate futures;
# use async_std::{
# net::TcpStream,
# prelude::*,
# };
use futures_channel::mpsc; // 1
use futures_util::sink::SinkExt;
use futures::channel::mpsc; // 1
use futures::sink::SinkExt;
use std::sync::Arc;
# type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;

@ -615,9 +615,9 @@ impl Path {
/// ```no_run
/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
/// #
/// use async_std::path::Path;
/// use async_std::fs;
/// use futures_util::stream::StreamExt;
/// use async_std::path::Path;
/// use async_std::prelude::*;
///
/// let path = Path::new("/laputa");
/// let mut dir = fs::read_dir(&path).await.expect("read_dir call failed");

@ -204,9 +204,9 @@ impl BarrierWaitResult {
#[cfg(test)]
mod test {
use futures_channel::mpsc::unbounded;
use futures_util::sink::SinkExt;
use futures_util::stream::StreamExt;
use futures::channel::mpsc::unbounded;
use futures::sink::SinkExt;
use futures::stream::StreamExt;
use crate::sync::{Arc, Barrier};
use crate::task;

Loading…
Cancel
Save