diff --git a/src/error.rs b/src/error.rs index f9c5824..41ffff7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -17,7 +17,7 @@ where /// Attempted to issue a `call` when no more requests can be in flight. /// - /// See [`tower_service::Service::poll_ready`] and [`Client::with_limit`]. + /// See [`tower_service::Service::poll_ready`]. TransportFull, /// Attempted to issue a `call`, but the underlying transport has been closed. diff --git a/src/lib.rs b/src/lib.rs index 5419325..0228876 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -232,3 +232,20 @@ mod sealed { pub mod multiplex; pub mod pipeline; + +/// impl Future. +/// +/// https://github.com/rust-lang/rust/issues/65863 +#[cfg(doc)] +pub struct DocFuture(std::marker::PhantomData); + +#[cfg(doc)] +impl std::future::Future for DocFuture { + type Output = O; + fn poll( + self: std::pin::Pin<&mut Self>, + _: &mut std::task::Context<'_>, + ) -> std::task::Poll { + unreachable!() + } +} diff --git a/src/multiplex/client.rs b/src/multiplex/client.rs index c4c50ad..e6043c7 100644 --- a/src/multiplex/client.rs +++ b/src/multiplex/client.rs @@ -93,7 +93,11 @@ where { type Error = SpawnError; type Response = Client, Request>; + + #[cfg(not(doc))] type Future = impl Future> + Send; + #[cfg(doc)] + type Future = crate::DocFuture>; fn call(&mut self, target: Target) -> Self::Future { let maker = self.t_maker.make_transport(target); @@ -390,7 +394,11 @@ where { type Response = T::Ok; type Error = E; + + #[cfg(not(doc))] type Future = impl Future> + Send; + #[cfg(doc)] + type Future = crate::DocFuture>; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { Poll::Ready(ready!(self.mediator.poll_ready(cx)).map_err(|_| E::from(Error::ClientDropped))) diff --git a/src/multiplex/mod.rs b/src/multiplex/mod.rs index f63cb1b..4aa780b 100644 --- a/src/multiplex/mod.rs +++ b/src/multiplex/mod.rs @@ -26,7 +26,7 @@ pub mod server; pub use self::server::Server; /// A convenience wrapper that lets you take separate transport and tag store types and use them as -/// a single [`client::Transport`]. +/// a single transport. #[pin_project] #[derive(Debug)] pub struct MultiplexTransport { diff --git a/src/pipeline/client.rs b/src/pipeline/client.rs index 05032e5..f3b8544 100644 --- a/src/pipeline/client.rs +++ b/src/pipeline/client.rs @@ -72,7 +72,11 @@ where { type Error = SpawnError; type Response = Client, Request>; + + #[cfg(not(doc))] type Future = impl Future> + Send; + #[cfg(doc)] + type Future = crate::DocFuture>; fn call(&mut self, target: Target) -> Self::Future { let maker = self.t_maker.make_transport(target); @@ -350,7 +354,11 @@ where { type Response = T::Ok; type Error = E; + + #[cfg(not(doc))] type Future = impl Future> + Send; + #[cfg(doc)] + type Future = crate::DocFuture>; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { Poll::Ready(ready!(self.mediator.poll_ready(cx)).map_err(|_| E::from(Error::ClientDropped)))