use std::task::{Context, Poll};
use super::Connection;
#[derive(Debug, Default, Clone)]
pub struct ClientExecutorService {
_priv: (),
}
impl ClientExecutorService {
pub fn new() -> Self {
Self { _priv: () }
}
}
impl<C, R> tower::Service<(C, R)> for ClientExecutorService
where
C: Connection<R>,
{
type Response = C::Response;
type Error = C::Error;
type Future = C::Future;
fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, (mut conn, req): (C, R)) -> Self::Future {
conn.send_request(req)
}
}