diff --git a/README.md b/README.md index 86f3c379..2e43fc3e 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ your `Cargo.toml`: ```toml anyhow = "1.0" futures = "0.3" -tarpc = { version = "0.31", features = ["tokio1"] } +tarpc = { version = "0.34", features = ["tokio1"] } tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] } ``` @@ -93,7 +93,6 @@ For a more real-world example, see [example-service](example-service). First, let's set up the dependencies and service definition. ```rust -use futures::future::{self, Ready}; use tarpc::{ client, context, server::{self, Channel}, diff --git a/tarpc/src/client.rs b/tarpc/src/client.rs index 2f3fdf08..44d6d5f3 100644 --- a/tarpc/src/client.rs +++ b/tarpc/src/client.rs @@ -1141,7 +1141,6 @@ mod tests { trait PollTest { type T; - fn unwrap(self) -> Poll; fn ready(self) -> Self::T; } @@ -1151,15 +1150,6 @@ mod tests { { type T = Option; - fn unwrap(self) -> Poll> { - match self { - Poll::Ready(Some(Ok(t))) => Poll::Ready(Some(t)), - Poll::Ready(None) => Poll::Ready(None), - Poll::Ready(Some(Err(e))) => panic!("{}", e.to_string()), - Poll::Pending => Poll::Pending, - } - } - fn ready(self) -> Option { match self { Poll::Ready(Some(Ok(t))) => Some(t), diff --git a/tarpc/src/lib.rs b/tarpc/src/lib.rs index ea4a9bb3..ae0b7160 100644 --- a/tarpc/src/lib.rs +++ b/tarpc/src/lib.rs @@ -54,7 +54,7 @@ //! Add to your `Cargo.toml` dependencies: //! //! ```toml -//! tarpc = "0.29" +//! tarpc = "0.34" //! ``` //! //! The `tarpc::service` attribute expands to a collection of items that form an rpc service. @@ -69,7 +69,7 @@ //! ```toml //! anyhow = "1.0" //! futures = "0.3" -//! tarpc = { version = "0.29", features = ["tokio1"] } +//! tarpc = { version = "0.34", features = ["tokio1"] } //! tokio = { version = "1.0", features = ["macros"] } //! ``` //! @@ -83,7 +83,6 @@ //! # extern crate futures; //! //! use futures::{ -//! future::{self, Ready}, //! prelude::*, //! }; //! use tarpc::{ @@ -106,7 +105,6 @@ //! ```rust //! # extern crate futures; //! # use futures::{ -//! # future::{self, Ready}, //! # prelude::*, //! # }; //! # use tarpc::{ @@ -141,7 +139,6 @@ //! ```rust //! # extern crate futures; //! # use futures::{ -//! # future::{self, Ready}, //! # prelude::*, //! # }; //! # use tarpc::{ @@ -253,9 +250,7 @@ pub(crate) mod util; pub use crate::transport::sealed::Transport; -use anyhow::Context as _; -use futures::task::*; -use std::{any::Any, error::Error, fmt::Display, io, sync::Arc, time::Instant}; +use std::{any::Any, error::Error, io, sync::Arc, time::Instant}; /// A message from a client to a server. #[derive(Debug)] @@ -504,37 +499,6 @@ impl Request { } } -pub(crate) trait PollContext { - fn context(self, context: C) -> Poll>> - where - C: Display + Send + Sync + 'static; - - fn with_context(self, f: F) -> Poll>> - where - C: Display + Send + Sync + 'static, - F: FnOnce() -> C; -} - -impl PollContext for Poll>> -where - E: Error + Send + Sync + 'static, -{ - fn context(self, context: C) -> Poll>> - where - C: Display + Send + Sync + 'static, - { - self.map(|o| o.map(|r| r.context(context))) - } - - fn with_context(self, f: F) -> Poll>> - where - C: Display + Send + Sync + 'static, - F: FnOnce() -> C, - { - self.map(|o| o.map(|r| r.with_context(f))) - } -} - #[test] fn test_channel_any_casts() { use assert_matches::assert_matches; @@ -566,7 +530,7 @@ fn test_channel_error_upcast() { #[derive(Debug)] struct E; - impl Display for E { + impl fmt::Display for E { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "E") } diff --git a/tarpc/tests/service_functional.rs b/tarpc/tests/service_functional.rs index 3ac3c638..2ab2c667 100644 --- a/tarpc/tests/service_functional.rs +++ b/tarpc/tests/service_functional.rs @@ -54,9 +54,6 @@ async fn dropped_channel_aborts_in_flight_requests() -> anyhow::Result<()> { #[derive(Clone)] struct LoopServer; - #[derive(Debug)] - struct AllHandlersComplete; - impl Loop for LoopServer { async fn r#loop(self, _: context::Context) { loop {