From 85312d430cb04e41ee97d0d78795595d8d30a4c0 Mon Sep 17 00:00:00 2001 From: iovxw Date: Tue, 16 Jul 2019 09:20:19 +0800 Subject: [PATCH] Update to futures-preview 0.3.0-alpha.17 (#238) * Update to futures-preview 0.3.0-alpha.17 * Update feature gate async_closure was moved out from async_await --- README.md | 2 +- bincode-transport/Cargo.toml | 2 +- bincode-transport/src/lib.rs | 2 +- bincode-transport/tests/cancel.rs | 1 + bincode-transport/tests/pushback.rs | 1 + example-service/Cargo.toml | 2 +- json-transport/Cargo.toml | 2 +- json-transport/src/lib.rs | 2 +- json-transport/tests/cancel.rs | 1 + json-transport/tests/pushback.rs | 1 + rpc/Cargo.toml | 4 ++-- rpc/src/lib.rs | 3 ++- rpc/src/server/mod.rs | 3 +-- rpc/src/transport/channel.rs | 4 ++-- rpc/src/transport/mod.rs | 16 ++++++++-------- tarpc/Cargo.toml | 2 +- 16 files changed, 26 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 03ddd6d..f7f5110 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ For this example, in addition to tarpc, also add two other dependencies to your `Cargo.toml`: ```toml -futures-preview = { version = "0.3.0-alpha.16", features = ["compat"] } +futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] } tokio = "0.1" ``` diff --git a/bincode-transport/Cargo.toml b/bincode-transport/Cargo.toml index 3dfa6af..f6aec47 100644 --- a/bincode-transport/Cargo.toml +++ b/bincode-transport/Cargo.toml @@ -14,7 +14,7 @@ description = "A bincode-based transport for tarpc services." [dependencies] bincode = "1" -futures-preview = { version = "0.3.0-alpha.16", features = ["compat"] } +futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] } futures_legacy = { version = "0.1", package = "futures" } pin-utils = "0.1.0-alpha.4" rpc = { package = "tarpc-lib", version = "0.6", path = "../rpc", features = ["serde1"] } diff --git a/bincode-transport/src/lib.rs b/bincode-transport/src/lib.rs index 6ff3f66..b4f9da0 100644 --- a/bincode-transport/src/lib.rs +++ b/bincode-transport/src/lib.rs @@ -60,7 +60,7 @@ where S: AsyncWrite, SinkItem: Serialize, { - type SinkError = io::Error; + type Error = io::Error; fn start_send(self: Pin<&mut Self>, item: SinkItem) -> io::Result<()> { self.inner() diff --git a/bincode-transport/tests/cancel.rs b/bincode-transport/tests/cancel.rs index b9950a1..0968dc4 100644 --- a/bincode-transport/tests/cancel.rs +++ b/bincode-transport/tests/cancel.rs @@ -7,6 +7,7 @@ //! Tests client/server control flow. #![feature(async_await)] +#![feature(async_closure)] use futures::{ compat::{Executor01CompatExt, Future01CompatExt}, diff --git a/bincode-transport/tests/pushback.rs b/bincode-transport/tests/pushback.rs index 72a5957..2ae50da 100644 --- a/bincode-transport/tests/pushback.rs +++ b/bincode-transport/tests/pushback.rs @@ -7,6 +7,7 @@ //! Tests client/server control flow. #![feature(async_await)] +#![feature(async_closure)] use futures::{ compat::{Executor01CompatExt, Future01CompatExt}, diff --git a/example-service/Cargo.toml b/example-service/Cargo.toml index f25cd89..dcbe4a6 100644 --- a/example-service/Cargo.toml +++ b/example-service/Cargo.toml @@ -15,7 +15,7 @@ description = "An example server built on tarpc." [dependencies] bincode-transport = { package = "tarpc-bincode-transport", version = "0.7", path = "../bincode-transport" } clap = "2.0" -futures-preview = { version = "0.3.0-alpha.16", features = ["compat"] } +futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] } serde = { version = "1.0" } tarpc = { version = "0.18", path = "../tarpc", features = ["serde1"] } tokio = "0.1" diff --git a/json-transport/Cargo.toml b/json-transport/Cargo.toml index 982457e..174eb1d 100644 --- a/json-transport/Cargo.toml +++ b/json-transport/Cargo.toml @@ -13,7 +13,7 @@ readme = "../README.md" description = "A JSON-based transport for tarpc services." [dependencies] -futures-preview = { version = "0.3.0-alpha.16", features = ["compat"] } +futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] } futures_legacy = { version = "0.1", package = "futures" } pin-utils = "0.1.0-alpha.4" rpc = { package = "tarpc-lib", version = "0.6", path = "../rpc", features = ["serde1"] } diff --git a/json-transport/src/lib.rs b/json-transport/src/lib.rs index e1c9109..4e8b4e2 100644 --- a/json-transport/src/lib.rs +++ b/json-transport/src/lib.rs @@ -67,7 +67,7 @@ where S: AsyncWrite, SinkItem: Serialize, { - type SinkError = io::Error; + type Error = io::Error; fn start_send(self: Pin<&mut Self>, item: SinkItem) -> io::Result<()> { self.inner() diff --git a/json-transport/tests/cancel.rs b/json-transport/tests/cancel.rs index 9f62cf7..89f2e71 100644 --- a/json-transport/tests/cancel.rs +++ b/json-transport/tests/cancel.rs @@ -7,6 +7,7 @@ //! Tests client/server control flow. #![feature(async_await)] +#![feature(async_closure)] use futures::{ compat::{Executor01CompatExt, Future01CompatExt}, diff --git a/json-transport/tests/pushback.rs b/json-transport/tests/pushback.rs index 81f8f0e..e330970 100644 --- a/json-transport/tests/pushback.rs +++ b/json-transport/tests/pushback.rs @@ -7,6 +7,7 @@ //! Tests client/server control flow. #![feature(async_await)] +#![feature(async_closure)] use futures::{ compat::{Executor01CompatExt, Future01CompatExt}, diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 3d3ba7f..ea06de3 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -18,7 +18,7 @@ serde1 = ["trace/serde", "serde", "serde/derive"] [dependencies] fnv = "1.0" -futures-preview = { version = "0.3.0-alpha.16", features = ["compat"] } +futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] } humantime = "1.0" log = "0.4" pin-utils = "0.1.0-alpha.4" @@ -28,7 +28,7 @@ trace = { package = "tarpc-trace", version = "0.2", path = "../trace" } serde = { optional = true, version = "1.0" } [dev-dependencies] -futures-test-preview = { version = "0.3.0-alpha.16" } +futures-test-preview = { version = "0.3.0-alpha.17" } env_logger = "0.6" tokio = "0.1" tokio-executor = "0.1" diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index fec9dd7..2830244 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -9,7 +9,8 @@ integer_atomics, try_trait, arbitrary_self_types, - async_await + async_await, + async_closure )] #![deny(missing_docs, missing_debug_implementations)] diff --git a/rpc/src/server/mod.rs b/rpc/src/server/mod.rs index 16a8d9b..becdbaf 100644 --- a/rpc/src/server/mod.rs +++ b/rpc/src/server/mod.rs @@ -18,7 +18,6 @@ use futures::{ ready, stream::Fuse, task::{Context, Poll}, - try_ready, }; use humantime::format_rfc3339; use log::{debug, error, info, trace, warn}; @@ -334,7 +333,7 @@ where peer, self.as_mut().in_flight_requests().len(), ); - try_ready!(self.as_mut().channel().poll_flush(cx)); + ready!(self.as_mut().channel().poll_flush(cx)?); } } Poll::Ready(Ok(())) diff --git a/rpc/src/transport/channel.rs b/rpc/src/transport/channel.rs index a567950..fea127b 100644 --- a/rpc/src/transport/channel.rs +++ b/rpc/src/transport/channel.rs @@ -51,7 +51,7 @@ impl Stream for UnboundedChannel { } impl Sink for UnboundedChannel { - type SinkError = io::Error; + type Error = io::Error; fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.tx() @@ -65,7 +65,7 @@ impl Sink for UnboundedChannel { .map_err(|_| io::Error::from(io::ErrorKind::NotConnected)) } - fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.tx() .poll_flush(cx) .map_err(|_| io::Error::from(io::ErrorKind::NotConnected)) diff --git a/rpc/src/transport/mod.rs b/rpc/src/transport/mod.rs index b926450..61c0a05 100644 --- a/rpc/src/transport/mod.rs +++ b/rpc/src/transport/mod.rs @@ -24,7 +24,7 @@ pub mod channel; pub trait Transport where Self: Stream::Item>>, - Self: Sink<::SinkItem, SinkError = io::Error>, + Self: Sink<::SinkItem, Error = io::Error>, { /// The type read off the transport. type Item; @@ -45,7 +45,7 @@ pub fn new( ) -> impl Transport where S: Stream>, - S: Sink, + S: Sink, { TransportShim { inner, @@ -83,21 +83,21 @@ impl Sink for TransportShim where S: Sink, { - type SinkError = S::SinkError; + type Error = S::Error; - fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), S::SinkError> { + fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), S::Error> { self.inner().start_send(item) } - fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.inner().poll_ready(cx) } - fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.inner().poll_flush(cx) } - fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.inner().poll_close(cx) } } @@ -106,7 +106,7 @@ impl Transport for TransportShim where S: Stream + Sink, Self: Stream>, - Self: Sink, + Self: Sink, { type Item = Item; type SinkItem = SinkItem; diff --git a/tarpc/Cargo.toml b/tarpc/Cargo.toml index e894038..5ecdfd2 100644 --- a/tarpc/Cargo.toml +++ b/tarpc/Cargo.toml @@ -19,7 +19,7 @@ serde1 = ["rpc/serde1", "serde", "serde/derive"] travis-ci = { repository = "google/tarpc" } [dependencies] -futures-preview = { version = "0.3.0-alpha.16", features = ["compat"] } +futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] } log = "0.4" serde = { optional = true, version = "1.0" } rpc = { package = "tarpc-lib", path = "../rpc", version = "0.6" }