chore(dependencies): update futures to 0.3.1

This commit is contained in:
Daniel Johnson
2019-11-14 10:04:16 -08:00
committed by Sean McArthur
parent 9d9233ce7c
commit 71d088d3d0
10 changed files with 29 additions and 36 deletions

View File

@@ -21,9 +21,9 @@ include = [
[dependencies] [dependencies]
bytes = "0.4.6" bytes = "0.4.6"
futures-core-preview = "=0.3.0-alpha.19" futures-core = "0.3.1"
futures-channel-preview = "=0.3.0-alpha.19" futures-channel = "0.3.1"
futures-util-preview = "=0.3.0-alpha.19" futures-util = "0.3.1"
http = "0.1.15" http = "0.1.15"
http-body = "=0.2.0-alpha.3" http-body = "=0.2.0-alpha.3"
httparse = "1.0" httparse = "1.0"
@@ -48,6 +48,7 @@ tokio-timer = { version = "=0.3.0-alpha.6", optional = true }
[dev-dependencies] [dev-dependencies]
futures-util-a19 = { version = "=0.3.0-alpha.19", package = "futures-util-preview" }
matches = "0.1" matches = "0.1"
num_cpus = "1.0" num_cpus = "1.0"
pretty_env_logger = "0.3" pretty_env_logger = "0.3"

View File

@@ -487,7 +487,7 @@ impl From<Cow<'static, str>> for Body {
impl Sender { impl Sender {
/// Check to see if this `Sender` can send more data. /// Check to see if this `Sender` can send more data.
pub fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<crate::Result<()>> { pub fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<crate::Result<()>> {
match self.abort_tx.poll_cancel(cx) { match self.abort_tx.poll_canceled(cx) {
Poll::Ready(()) => return Poll::Ready(Err(crate::Error::new_closed())), Poll::Ready(()) => return Poll::Ready(Err(crate::Error::new_closed())),
Poll::Pending => (), // fallthrough Poll::Pending => (), // fallthrough
} }

View File

@@ -194,10 +194,10 @@ impl<T, U> Callback<T, U> {
} }
} }
pub(crate) fn poll_cancel(&mut self, cx: &mut task::Context<'_>) -> Poll<()> { pub(crate) fn poll_canceled(&mut self, cx: &mut task::Context<'_>) -> Poll<()> {
match *self { match *self {
Callback::Retry(ref mut tx) => tx.poll_cancel(cx), Callback::Retry(ref mut tx) => tx.poll_canceled(cx),
Callback::NoRetry(ref mut tx) => tx.poll_cancel(cx), Callback::NoRetry(ref mut tx) => tx.poll_canceled(cx),
} }
} }
@@ -229,7 +229,7 @@ impl<T, U> Callback<T, U> {
}, },
Poll::Pending => { Poll::Pending => {
// check if the callback is canceled // check if the callback is canceled
ready!(cb.as_mut().unwrap().poll_cancel(cx)); ready!(cb.as_mut().unwrap().poll_canceled(cx));
trace!("send_when canceled"); trace!("send_when canceled");
Poll::Ready(()) Poll::Ready(())
}, },

View File

@@ -64,8 +64,7 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use futures_channel::oneshot; use futures_channel::oneshot;
use futures_util::future::{self, FutureExt as _, Either}; use futures_util::future::{self, FutureExt as _, TryFutureExt as _, Either};
use futures_util::try_future::TryFutureExt as _;
use http::{Method, Request, Response, Uri, Version}; use http::{Method, Request, Response, Uri, Version};
use http::header::{HeaderValue, HOST}; use http::header::{HeaderValue, HOST};
use http::uri::Scheme; use http::uri::Scheme;

View File

@@ -733,9 +733,6 @@ impl<T: Poolable + 'static> Future for IdleTask<T> {
type Output = (); type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> { fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
// Interval is a Stream
use futures_core::Stream;
loop { loop {
match Pin::new(&mut self.pool_drop_notifier).poll(cx) { match Pin::new(&mut self.pool_drop_notifier).poll(cx) {
Poll::Ready(Ok(n)) => match n {}, Poll::Ready(Ok(n)) => match n {},

View File

@@ -511,7 +511,7 @@ where
match self.rx.poll_next(cx) { match self.rx.poll_next(cx) {
Poll::Ready(Some((req, mut cb))) => { Poll::Ready(Some((req, mut cb))) => {
// check that future hasn't been canceled already // check that future hasn't been canceled already
match cb.poll_cancel(cx) { match cb.poll_canceled(cx) {
Poll::Ready(()) => { Poll::Ready(()) => {
trace!("request canceled"); trace!("request canceled");
Poll::Ready(None) Poll::Ready(None)
@@ -579,7 +579,7 @@ where
fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), ()>> { fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), ()>> {
match self.callback { match self.callback {
Some(ref mut cb) => match cb.poll_cancel(cx) { Some(ref mut cb) => match cb.poll_canceled(cx) {
Poll::Ready(()) => { Poll::Ready(()) => {
trace!("callback receiver has dropped"); trace!("callback receiver has dropped");
Poll::Ready(Err(())) Poll::Ready(Err(()))

View File

@@ -1,7 +1,6 @@
use futures_channel::{mpsc, oneshot}; use futures_channel::{mpsc, oneshot};
use futures_util::future::{self, FutureExt as _, Either}; use futures_util::future::{self, FutureExt as _, TryFutureExt as _, Either};
use futures_util::stream::StreamExt as _; use futures_util::stream::StreamExt as _;
use futures_util::try_future::TryFutureExt as _;
use h2::client::{Builder, SendRequest}; use h2::client::{Builder, SendRequest};
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};

View File

@@ -14,9 +14,8 @@ use hyper::{Body, Client, Method, Request, StatusCode};
use futures_core::{Future, Stream, TryFuture}; use futures_core::{Future, Stream, TryFuture};
use futures_channel::oneshot; use futures_channel::oneshot;
use futures_util::future::{self, FutureExt}; use futures_util::future::{self, FutureExt, TryFutureExt};
use futures_util::try_future::{self, TryFutureExt}; use futures_util::stream::TryStreamExt;
use futures_util::try_stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio_net::tcp::TcpStream; use tokio_net::tcp::TcpStream;
@@ -256,7 +255,7 @@ macro_rules! test {
let rx = rx.expect("thread panicked"); let rx = rx.expect("thread panicked");
rt.block_on(try_future::try_join(res, rx).map_ok(|r| r.0)).map(move |mut resp| { rt.block_on(future::try_join(res, rx).map_ok(|r| r.0)).map(move |mut resp| {
// Always check that HttpConnector has set the "extra" info... // Always check that HttpConnector has set the "extra" info...
let extra = resp let extra = resp
.extensions_mut() .extensions_mut()
@@ -931,10 +930,8 @@ mod dispatch_impl {
use futures_core::{self, Future}; use futures_core::{self, Future};
use futures_channel::{mpsc, oneshot}; use futures_channel::{mpsc, oneshot};
use futures_util::future::FutureExt; use futures_util::future::{FutureExt, TryFutureExt};
use futures_util::stream::StreamExt; use futures_util::stream::{StreamExt, TryStreamExt};
use futures_util::try_future::TryFutureExt;
use futures_util::try_stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use tokio_net::tcp::TcpStream; use tokio_net::tcp::TcpStream;
@@ -1673,7 +1670,7 @@ mod dispatch_impl {
let res1 = client.get(url.clone()); let res1 = client.get(url.clone());
let res2 = client.get(url.clone()); let res2 = client.get(url.clone());
let res3 = client.get(url.clone()); let res3 = client.get(url.clone());
rt.block_on(try_future::try_join3(res1, res2, res3)).unwrap(); rt.block_on(future::try_join3(res1, res2, res3)).unwrap();
// Since the client doesn't know it can ALPN at first, it will have // Since the client doesn't know it can ALPN at first, it will have
// started 3 connections. But, the server above will only handle 1, // started 3 connections. But, the server above will only handle 1,
@@ -1792,9 +1789,8 @@ mod conn {
use std::time::{Duration}; use std::time::{Duration};
use futures_channel::oneshot; use futures_channel::oneshot;
use futures_util::future::{self, poll_fn, FutureExt}; use futures_util::future::{self, poll_fn, FutureExt, TryFutureExt};
use futures_util::try_future::TryFutureExt; use futures_util::stream::TryStreamExt;
use futures_util::try_stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio_io::{AsyncRead, AsyncReadExt as _, AsyncWrite, AsyncWriteExt as _}; use tokio_io::{AsyncRead, AsyncReadExt as _, AsyncWrite, AsyncWriteExt as _};
use tokio_net::tcp::{TcpListener as TkTcpListener, TcpStream}; use tokio_net::tcp::{TcpListener as TkTcpListener, TcpStream};

View File

@@ -15,10 +15,11 @@ use std::time::Duration;
use futures_channel::oneshot; use futures_channel::oneshot;
use futures_core::ready; use futures_core::ready;
use futures_core::future::BoxFuture; use futures_core::future::BoxFuture;
use futures_util::future::{self, Either, FutureExt}; use futures_util::future::{self, Either, FutureExt, TryFutureExt};
use futures_util::stream::StreamExt; #[cfg(feature = "unstable-stream")]
use futures_util::try_future::{self, TryFutureExt}; use futures_util::stream::StreamExt as _;
//use futures_util::try_stream::TryStreamExt; // TODO: remove once tokio is updated to futures 0.3
use futures_util_a19::stream::StreamExt as _;
use http::header::{HeaderName, HeaderValue}; use http::header::{HeaderName, HeaderValue};
use tokio_net::driver::Handle; use tokio_net::driver::Handle;
use tokio_net::tcp::{TcpListener, TcpStream as TkTcpStream}; use tokio_net::tcp::{TcpListener, TcpStream as TkTcpStream};
@@ -879,7 +880,7 @@ fn disable_keep_alive_mid_request() {
.map_err(|_| unreachable!()) .map_err(|_| unreachable!())
.and_then(|socket| { .and_then(|socket| {
let srv = Http::new().serve_connection(socket, HelloWorld); let srv = Http::new().serve_connection(socket, HelloWorld);
try_future::try_select(srv, rx1) future::try_select(srv, rx1)
.then(|r| { .then(|r| {
match r { match r {
Ok(Either::Left(_)) => panic!("expected rx first"), Ok(Either::Left(_)) => panic!("expected rx first"),
@@ -938,7 +939,7 @@ fn disable_keep_alive_post_request() {
_debug: dropped2, _debug: dropped2,
}; };
let server = Http::new().serve_connection(transport, HelloWorld); let server = Http::new().serve_connection(transport, HelloWorld);
try_future::try_select(server, rx1) future::try_select(server, rx1)
.then(|r| { .then(|r| {
match r { match r {
Ok(Either::Left(_)) => panic!("expected rx first"), Ok(Either::Left(_)) => panic!("expected rx first"),

View File

@@ -8,7 +8,7 @@ use hyper::client::HttpConnector;
use hyper::service::{make_service_fn, service_fn}; use hyper::service::{make_service_fn, service_fn};
pub use std::net::SocketAddr; pub use std::net::SocketAddr;
pub use futures_util::{future, try_future, FutureExt as _, StreamExt as _, TryFutureExt as _, TryStreamExt as _}; pub use futures_util::{future, FutureExt as _, StreamExt as _, TryFutureExt as _, TryStreamExt as _};
//pub use self::futures_channel::oneshot; //pub use self::futures_channel::oneshot;
pub use hyper::{HeaderMap, StatusCode}; pub use hyper::{HeaderMap, StatusCode};
pub use tokio::runtime::current_thread::Runtime; pub use tokio::runtime::current_thread::Runtime;