Skip to content

Commit

Permalink
Implement tower Service for Client
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathspy committed Apr 20, 2022
1 parent 22f4709 commit 1166499
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/async_impl/client.rs
Expand Up @@ -1515,6 +1515,20 @@ impl fmt::Debug 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 Expand Up @@ -1665,7 +1679,7 @@ impl ClientRef {
}

pin_project! {
pub(super) struct Pending {
pub struct Pending {
#[pin]
inner: PendingInner,
}
Expand Down

0 comments on commit 1166499

Please sign in to comment.