From 68127f0425e510d2319f4fc22f97f84e5612e63d Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 19 Aug 2024 15:31:02 -0400 Subject: [PATCH] Revert "feat: Add `impl Service>` for `Client` and `&'_ Client` (#2356)" This reverts commit 522216e890ccb13c43fb0d92af9598b3bedaaec5. --- src/async_impl/client.rs | 56 ---------------------------------------- 1 file changed, 56 deletions(-) diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs index d7defc578..0a7281c42 100644 --- a/src/async_impl/client.rs +++ b/src/async_impl/client.rs @@ -2161,62 +2161,6 @@ impl tower_service::Service for &'_ Client { } } -impl tower_service::Service> for Client { - type Response = http::Response; - type Error = crate::Error; - type Future = MappedPending; - - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { - Poll::Ready(Ok(())) - } - - fn call(&mut self, req: http::Request) -> Self::Future { - match req.try_into() { - Ok(req) => MappedPending::new(self.execute_request(req)), - Err(err) => MappedPending::new(Pending::new_err(err)), - } - } -} - -impl tower_service::Service> for &'_ Client { - type Response = http::Response; - type Error = crate::Error; - type Future = MappedPending; - - fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { - Poll::Ready(Ok(())) - } - - fn call(&mut self, req: http::Request) -> Self::Future { - match req.try_into() { - Ok(req) => MappedPending::new(self.execute_request(req)), - Err(err) => MappedPending::new(Pending::new_err(err)), - } - } -} - -pin_project! { - pub struct MappedPending { - #[pin] - inner: Pending, - } -} - -impl MappedPending { - fn new(inner: Pending) -> MappedPending { - Self { inner } - } -} - -impl Future for MappedPending { - type Output = Result, crate::Error>; - - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - let inner = self.project().inner; - inner.poll(cx).map_ok(Into::into) - } -} - impl fmt::Debug for ClientBuilder { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut builder = f.debug_struct("ClientBuilder");