mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
chore: update futures to 0.3.0 (#1741)
This commit is contained in:
parent
1a7f6fb201
commit
6f8b986bdb
@ -9,7 +9,7 @@ tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
tokio-util = { version = "=0.2.0-alpha.6", path = "../tokio-util" }
|
||||
|
||||
bytes = "0.4.12"
|
||||
futures-preview = "=0.3.0-alpha.19"
|
||||
futures = "0.3.0"
|
||||
|
||||
[[example]]
|
||||
name = "chat"
|
||||
|
@ -30,7 +30,7 @@ use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::sync::{mpsc, Mutex};
|
||||
use tokio_util::codec::{Framed, LinesCodec, LinesCodecError};
|
||||
|
||||
use futures::{Poll, SinkExt, Stream, StreamExt};
|
||||
use futures::{SinkExt, Stream, StreamExt};
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
@ -38,7 +38,7 @@ use std::io;
|
||||
use std::net::SocketAddr;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::task::Context;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
@ -20,7 +20,7 @@ use tokio::io;
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use tokio_util::codec::{FramedRead, FramedWrite};
|
||||
|
||||
use futures::{SinkExt, Stream};
|
||||
use futures::{SinkExt, Stream, StreamExt};
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::net::SocketAddr;
|
||||
@ -69,7 +69,7 @@ async fn run() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
// Temporary work around for stdin blocking the stream
|
||||
fn stdin() -> impl Stream<Item = Result<Vec<u8>, io::Error>> + Unpin {
|
||||
let mut stdin = FramedRead::new(io::stdin(), codec::Bytes);
|
||||
let mut stdin = FramedRead::new(io::stdin(), codec::Bytes).map(Ok);
|
||||
|
||||
let (mut tx, rx) = mpsc::unbounded_channel();
|
||||
|
||||
@ -95,13 +95,15 @@ mod tcp {
|
||||
let mut stream = TcpStream::connect(addr).await?;
|
||||
let (r, w) = stream.split();
|
||||
let sink = FramedWrite::new(w, codec::Bytes);
|
||||
let mut stream = FramedRead::new(r, codec::Bytes).filter_map(|i| match i {
|
||||
Ok(i) => future::ready(Some(i)),
|
||||
Err(e) => {
|
||||
println!("failed to read from socket; error={}", e);
|
||||
future::ready(None)
|
||||
}
|
||||
});
|
||||
let mut stream = FramedRead::new(r, codec::Bytes)
|
||||
.filter_map(|i| match i {
|
||||
Ok(i) => future::ready(Some(i)),
|
||||
Err(e) => {
|
||||
println!("failed to read from socket; error={}", e);
|
||||
future::ready(None)
|
||||
}
|
||||
})
|
||||
.map(Ok);
|
||||
|
||||
match future::join(stdin.forward(sink), stdout.send_all(&mut stream)).await {
|
||||
(Err(e), _) | (_, Err(e)) => Err(e.into()),
|
||||
|
@ -11,4 +11,4 @@ publish = false
|
||||
tokio = { path = "../tokio" }
|
||||
tokio-test = { path = "../tokio-test" }
|
||||
|
||||
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
|
||||
futures = { version = "0.3.0", features = ["async-await"] }
|
||||
|
@ -23,10 +23,10 @@ categories = ["asynchronous", "testing"]
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
|
||||
bytes = "0.4"
|
||||
futures-core-preview = "=0.3.0-alpha.19"
|
||||
futures-core = "0.3.0"
|
||||
|
||||
[dev-dependencies]
|
||||
futures-util-preview = "=0.3.0-alpha.19"
|
||||
futures-util = "0.3.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
@ -33,7 +33,7 @@ tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
|
||||
cfg-if = "0.1"
|
||||
env_logger = { version = "0.6", default-features = false }
|
||||
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
|
||||
futures = { version = "0.3.0", features = ["async-await"] }
|
||||
|
||||
[target.'cfg(all(not(target_os = "macos"), not(windows), not(target_os = "ios")))'.dev-dependencies]
|
||||
openssl = "0.10"
|
||||
|
@ -23,15 +23,15 @@ categories = ["asynchronous"]
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
|
||||
bytes = "0.4.7"
|
||||
futures-core-preview = "=0.3.0-alpha.19"
|
||||
futures-sink-preview = "=0.3.0-alpha.19"
|
||||
futures-core = "0.3.0"
|
||||
futures-sink = "0.3.0"
|
||||
log = "0.4"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "=0.2.0-alpha.6", path = "../tokio" }
|
||||
tokio-test = { version = "=0.2.0-alpha.6", path = "../tokio-test" }
|
||||
|
||||
futures-util-preview = "=0.3.0-alpha.19"
|
||||
futures-util = "0.3.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
@ -6,8 +6,8 @@
|
||||
//!
|
||||
//! [`AsyncRead`]: https://docs.rs/tokio/*/tokio/io/trait.AsyncRead.html
|
||||
//! [`AsyncWrite`]: https://docs.rs/tokio/*/tokio/io/trait.AsyncWrite.html
|
||||
//! [`Sink`]: https://docs.rs/futures-sink-preview/*/futures_sink/trait.Sink.html
|
||||
//! [`Stream`]: https://docs.rs/futures-core-preview/*/futures_core/stream/trait.Stream.html
|
||||
//! [`Sink`]: https://docs.rs/futures-sink/*/futures_sink/trait.Sink.html
|
||||
//! [`Stream`]: https://docs.rs/futures-core/*/futures_core/stream/trait.Stream.html
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
@ -3,10 +3,10 @@ use tokio_util::codec::{Decoder, Encoder};
|
||||
use tokio_util::udp::UdpFramed;
|
||||
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use futures_util::future::try_join;
|
||||
use futures_util::future::FutureExt;
|
||||
use futures_util::sink::SinkExt;
|
||||
use futures_util::stream::StreamExt;
|
||||
use futures_util::try_future::try_join;
|
||||
use std::io;
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -88,9 +88,9 @@ process = [
|
||||
[dependencies]
|
||||
tokio-macros = { version = "=0.2.0-alpha.6", optional = true, path = "../tokio-macros" }
|
||||
|
||||
futures-core-preview = "=0.3.0-alpha.19"
|
||||
futures-sink-preview = "=0.3.0-alpha.19"
|
||||
futures-util-preview = { version = "=0.3.0-alpha.19", features = ["sink", "channel"] }
|
||||
futures-core = "0.3.0"
|
||||
futures-sink = "0.3.0"
|
||||
futures-util = { version = "0.3.0", features = ["sink", "channel"] }
|
||||
|
||||
# Everything else is optional...
|
||||
bytes = { version = "0.4", optional = true }
|
||||
@ -119,8 +119,8 @@ optional = true
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-test = { version = "=0.2.0-alpha.6", path = "../tokio-test" }
|
||||
futures-preview = { version = "=0.3.0-alpha.19", features = ["async-await"] }
|
||||
loom = { version = "0.2.12", features = ["futures", "checkpoint"] }
|
||||
futures = { version = "0.3.0", features = ["async-await"] }
|
||||
loom = { version = "0.2.13", features = ["futures", "checkpoint"] }
|
||||
proptest = "0.9.4"
|
||||
tempfile = "3.1.0"
|
||||
|
||||
|
@ -121,7 +121,7 @@ use crate::io::{AsyncRead, AsyncReadExt, AsyncWrite};
|
||||
use crate::process::kill::Kill;
|
||||
|
||||
use futures_core::TryFuture;
|
||||
use futures_util::try_future::try_join3;
|
||||
use futures_util::future::try_join3;
|
||||
use std::ffi::OsStr;
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
|
@ -4,7 +4,7 @@ use tokio::fs;
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use futures_util::future;
|
||||
use futures_util::try_stream::TryStreamExt;
|
||||
use futures_util::stream::TryStreamExt;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use tempfile::tempdir;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user