diff --git a/src/client/mod.rs b/src/client/mod.rs index afb7aba9d1..1054ec2882 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -528,6 +528,26 @@ where C: Connect + Clone + Send + Sync + 'static, } } +impl tower_service::Service> for Client +where C: Connect + Clone + Send + Sync + 'static, + C::Transport: Unpin + Send + 'static, + C::Future: Unpin + Send + 'static, + B: Payload + Unpin + Send + 'static, + B::Data: Send + Unpin, +{ + type Response = Response; + type Error = crate::Error; + type Future = ResponseFuture; + + fn poll_ready(&mut self, _: &mut task::Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } + + fn call(&mut self, req: Request) -> Self::Future { + self.request(req) + } +} + impl Clone for Client { fn clone(&self) -> Client { Client {