Skip to content

Commit

Permalink
chore(dependencies): update futures to 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ComputerDruid authored and seanmonstar committed Nov 14, 2019
1 parent 9d9233c commit 71d088d
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 36 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ include = [

[dependencies]
bytes = "0.4.6"
futures-core-preview = "=0.3.0-alpha.19"
futures-channel-preview = "=0.3.0-alpha.19"
futures-util-preview = "=0.3.0-alpha.19"
futures-core = "0.3.1"
futures-channel = "0.3.1"
futures-util = "0.3.1"
http = "0.1.15"
http-body = "=0.2.0-alpha.3"
httparse = "1.0"
Expand All @@ -48,6 +48,7 @@ tokio-timer = { version = "=0.3.0-alpha.6", optional = true }


[dev-dependencies]
futures-util-a19 = { version = "=0.3.0-alpha.19", package = "futures-util-preview" }
matches = "0.1"
num_cpus = "1.0"
pretty_env_logger = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion src/body/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ impl From<Cow<'static, str>> for Body {
impl Sender {
/// Check to see if this `Sender` can send more data.
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::Pending => (), // fallthrough
}
Expand Down
8 changes: 4 additions & 4 deletions src/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Callback::Retry(ref mut tx) => tx.poll_cancel(cx),
Callback::NoRetry(ref mut tx) => tx.poll_cancel(cx),
Callback::Retry(ref mut tx) => tx.poll_canceled(cx),
Callback::NoRetry(ref mut tx) => tx.poll_canceled(cx),
}
}

Expand Down Expand Up @@ -229,7 +229,7 @@ impl<T, U> Callback<T, U> {
},
Poll::Pending => {
// 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");
Poll::Ready(())
},
Expand Down
3 changes: 1 addition & 2 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ use std::sync::Arc;
use std::time::Duration;

use futures_channel::oneshot;
use futures_util::future::{self, FutureExt as _, Either};
use futures_util::try_future::TryFutureExt as _;
use futures_util::future::{self, FutureExt as _, TryFutureExt as _, Either};
use http::{Method, Request, Response, Uri, Version};
use http::header::{HeaderValue, HOST};
use http::uri::Scheme;
Expand Down
3 changes: 0 additions & 3 deletions src/client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,6 @@ impl<T: Poolable + 'static> Future for IdleTask<T> {
type Output = ();

fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
// Interval is a Stream
use futures_core::Stream;

loop {
match Pin::new(&mut self.pool_drop_notifier).poll(cx) {
Poll::Ready(Ok(n)) => match n {},
Expand Down
4 changes: 2 additions & 2 deletions src/proto/h1/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ where
match self.rx.poll_next(cx) {
Poll::Ready(Some((req, mut cb))) => {
// check that future hasn't been canceled already
match cb.poll_cancel(cx) {
match cb.poll_canceled(cx) {
Poll::Ready(()) => {
trace!("request canceled");
Poll::Ready(None)
Expand Down Expand Up @@ -579,7 +579,7 @@ where

fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll<Result<(), ()>> {
match self.callback {
Some(ref mut cb) => match cb.poll_cancel(cx) {
Some(ref mut cb) => match cb.poll_canceled(cx) {
Poll::Ready(()) => {
trace!("callback receiver has dropped");
Poll::Ready(Err(()))
Expand Down
3 changes: 1 addition & 2 deletions src/proto/h2/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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::try_future::TryFutureExt as _;
use h2::client::{Builder, SendRequest};
use tokio_io::{AsyncRead, AsyncWrite};

Expand Down
20 changes: 8 additions & 12 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ use hyper::{Body, Client, Method, Request, StatusCode};

use futures_core::{Future, Stream, TryFuture};
use futures_channel::oneshot;
use futures_util::future::{self, FutureExt};
use futures_util::try_future::{self, TryFutureExt};
use futures_util::try_stream::TryStreamExt;
use futures_util::future::{self, FutureExt, TryFutureExt};
use futures_util::stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime;
use tokio_net::tcp::TcpStream;

Expand Down Expand Up @@ -256,7 +255,7 @@ macro_rules! test {

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...
let extra = resp
.extensions_mut()
Expand Down Expand Up @@ -931,10 +930,8 @@ mod dispatch_impl {

use futures_core::{self, Future};
use futures_channel::{mpsc, oneshot};
use futures_util::future::FutureExt;
use futures_util::stream::StreamExt;
use futures_util::try_future::TryFutureExt;
use futures_util::try_stream::TryStreamExt;
use futures_util::future::{FutureExt, TryFutureExt};
use futures_util::stream::{StreamExt, TryStreamExt};
use tokio::runtime::current_thread::Runtime;
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_net::tcp::TcpStream;
Expand Down Expand Up @@ -1673,7 +1670,7 @@ mod dispatch_impl {
let res1 = client.get(url.clone());
let res2 = 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
// started 3 connections. But, the server above will only handle 1,
Expand Down Expand Up @@ -1792,9 +1789,8 @@ mod conn {
use std::time::{Duration};

use futures_channel::oneshot;
use futures_util::future::{self, poll_fn, FutureExt};
use futures_util::try_future::TryFutureExt;
use futures_util::try_stream::TryStreamExt;
use futures_util::future::{self, poll_fn, FutureExt, TryFutureExt};
use futures_util::stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime;
use tokio_io::{AsyncRead, AsyncReadExt as _, AsyncWrite, AsyncWriteExt as _};
use tokio_net::tcp::{TcpListener as TkTcpListener, TcpStream};
Expand Down
13 changes: 7 additions & 6 deletions tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ use std::time::Duration;
use futures_channel::oneshot;
use futures_core::ready;
use futures_core::future::BoxFuture;
use futures_util::future::{self, Either, FutureExt};
use futures_util::stream::StreamExt;
use futures_util::try_future::{self, TryFutureExt};
//use futures_util::try_stream::TryStreamExt;
use futures_util::future::{self, Either, FutureExt, TryFutureExt};
#[cfg(feature = "unstable-stream")]
use futures_util::stream::StreamExt as _;
// TODO: remove once tokio is updated to futures 0.3
use futures_util_a19::stream::StreamExt as _;
use http::header::{HeaderName, HeaderValue};
use tokio_net::driver::Handle;
use tokio_net::tcp::{TcpListener, TcpStream as TkTcpStream};
Expand Down Expand Up @@ -879,7 +880,7 @@ fn disable_keep_alive_mid_request() {
.map_err(|_| unreachable!())
.and_then(|socket| {
let srv = Http::new().serve_connection(socket, HelloWorld);
try_future::try_select(srv, rx1)
future::try_select(srv, rx1)
.then(|r| {
match r {
Ok(Either::Left(_)) => panic!("expected rx first"),
Expand Down Expand Up @@ -938,7 +939,7 @@ fn disable_keep_alive_post_request() {
_debug: dropped2,
};
let server = Http::new().serve_connection(transport, HelloWorld);
try_future::try_select(server, rx1)
future::try_select(server, rx1)
.then(|r| {
match r {
Ok(Either::Left(_)) => panic!("expected rx first"),
Expand Down
2 changes: 1 addition & 1 deletion tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use hyper::client::HttpConnector;
use hyper::service::{make_service_fn, service_fn};

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 hyper::{HeaderMap, StatusCode};
pub use tokio::runtime::current_thread::Runtime;
Expand Down

0 comments on commit 71d088d

Please sign in to comment.