Skip to content

Commit edbd10a

Browse files
davidbarskyseanmonstar
authored andcommitted
feat(client): impl tower_service::Service for Client
1 parent 0b03b73 commit edbd10a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/client/mod.rs

+20
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,26 @@ where C: Connect + Clone + Send + Sync + 'static,
528528
}
529529
}
530530

531+
impl<C, B> tower_service::Service<Request<B>> for Client<C, B>
532+
where C: Connect + Clone + Send + Sync + 'static,
533+
C::Transport: Unpin + Send + 'static,
534+
C::Future: Unpin + Send + 'static,
535+
B: Payload + Unpin + Send + 'static,
536+
B::Data: Send + Unpin,
537+
{
538+
type Response = Response<Body>;
539+
type Error = crate::Error;
540+
type Future = ResponseFuture;
541+
542+
fn poll_ready(&mut self, _: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
543+
Poll::Ready(Ok(()))
544+
}
545+
546+
fn call(&mut self, req: Request<B>) -> Self::Future {
547+
self.request(req)
548+
}
549+
}
550+
531551
impl<C: Clone, B> Clone for Client<C, B> {
532552
fn clone(&self) -> Client<C, B> {
533553
Client {

0 commit comments

Comments
 (0)