|
54 | 54 | //! Add to your `Cargo.toml` dependencies: |
55 | 55 | //! |
56 | 56 | //! ```toml |
57 | | -//! tarpc = "0.29" |
| 57 | +//! tarpc = "0.34" |
58 | 58 | //! ``` |
59 | 59 | //! |
60 | 60 | //! The `tarpc::service` attribute expands to a collection of items that form an rpc service. |
|
69 | 69 | //! ```toml |
70 | 70 | //! anyhow = "1.0" |
71 | 71 | //! futures = "0.3" |
72 | | -//! tarpc = { version = "0.29", features = ["tokio1"] } |
| 72 | +//! tarpc = { version = "0.34", features = ["tokio1"] } |
73 | 73 | //! tokio = { version = "1.0", features = ["macros"] } |
74 | 74 | //! ``` |
75 | 75 | //! |
|
83 | 83 | //! # extern crate futures; |
84 | 84 | //! |
85 | 85 | //! use futures::{ |
86 | | -//! future::{self, Ready}, |
87 | 86 | //! prelude::*, |
88 | 87 | //! }; |
89 | 88 | //! use tarpc::{ |
|
106 | 105 | //! ```rust |
107 | 106 | //! # extern crate futures; |
108 | 107 | //! # use futures::{ |
109 | | -//! # future::{self, Ready}, |
110 | 108 | //! # prelude::*, |
111 | 109 | //! # }; |
112 | 110 | //! # use tarpc::{ |
|
141 | 139 | //! ```rust |
142 | 140 | //! # extern crate futures; |
143 | 141 | //! # use futures::{ |
144 | | -//! # future::{self, Ready}, |
145 | 142 | //! # prelude::*, |
146 | 143 | //! # }; |
147 | 144 | //! # use tarpc::{ |
@@ -253,9 +250,7 @@ pub(crate) mod util; |
253 | 250 |
|
254 | 251 | pub use crate::transport::sealed::Transport; |
255 | 252 |
|
256 | | -use anyhow::Context as _; |
257 | | -use futures::task::*; |
258 | | -use std::{any::Any, error::Error, fmt::Display, io, sync::Arc, time::Instant}; |
| 253 | +use std::{any::Any, error::Error, io, sync::Arc, time::Instant}; |
259 | 254 |
|
260 | 255 | /// A message from a client to a server. |
261 | 256 | #[derive(Debug)] |
@@ -504,37 +499,6 @@ impl<T> Request<T> { |
504 | 499 | } |
505 | 500 | } |
506 | 501 |
|
507 | | -pub(crate) trait PollContext<T> { |
508 | | - fn context<C>(self, context: C) -> Poll<Option<anyhow::Result<T>>> |
509 | | - where |
510 | | - C: Display + Send + Sync + 'static; |
511 | | - |
512 | | - fn with_context<C, F>(self, f: F) -> Poll<Option<anyhow::Result<T>>> |
513 | | - where |
514 | | - C: Display + Send + Sync + 'static, |
515 | | - F: FnOnce() -> C; |
516 | | -} |
517 | | - |
518 | | -impl<T, E> PollContext<T> for Poll<Option<Result<T, E>>> |
519 | | -where |
520 | | - E: Error + Send + Sync + 'static, |
521 | | -{ |
522 | | - fn context<C>(self, context: C) -> Poll<Option<anyhow::Result<T>>> |
523 | | - where |
524 | | - C: Display + Send + Sync + 'static, |
525 | | - { |
526 | | - self.map(|o| o.map(|r| r.context(context))) |
527 | | - } |
528 | | - |
529 | | - fn with_context<C, F>(self, f: F) -> Poll<Option<anyhow::Result<T>>> |
530 | | - where |
531 | | - C: Display + Send + Sync + 'static, |
532 | | - F: FnOnce() -> C, |
533 | | - { |
534 | | - self.map(|o| o.map(|r| r.with_context(f))) |
535 | | - } |
536 | | -} |
537 | | - |
538 | 502 | #[test] |
539 | 503 | fn test_channel_any_casts() { |
540 | 504 | use assert_matches::assert_matches; |
@@ -566,7 +530,7 @@ fn test_channel_error_upcast() { |
566 | 530 |
|
567 | 531 | #[derive(Debug)] |
568 | 532 | struct E; |
569 | | - impl Display for E { |
| 533 | + impl fmt::Display for E { |
570 | 534 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
571 | 535 | write!(f, "E") |
572 | 536 | } |
|
0 commit comments