Skip to content

Commit

Permalink
feat: enable client to be a service without ownership
Browse files Browse the repository at this point in the history
  • Loading branch information
neoeinstein committed Jun 8, 2022
1 parent d536ce2 commit 70dcb7d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/async_impl/client.rs
Expand Up @@ -1577,6 +1577,20 @@ impl tower_service::Service<Request> for Client {
}
}

impl tower_service::Service<Request> for &'_ Client {
type Response = Response;
type Error = crate::Error;
type Future = Pending;

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}

fn call(&mut self, req: Request) -> Self::Future {
self.execute_request(req)
}
}

impl fmt::Debug for ClientBuilder {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut builder = f.debug_struct("ClientBuilder");
Expand Down

0 comments on commit 70dcb7d

Please sign in to comment.