use better generic idents

This commit is contained in:
Jane Lusby 2020-06-17 17:35:02 -07:00 committed by Deirdre Connolly
parent 61489dbf5d
commit b727beb778
1 changed files with 20 additions and 20 deletions

View File

@ -13,19 +13,19 @@ use tower::Service;
/// Future that completes when the batch processing is complete. /// Future that completes when the batch processing is complete.
#[pin_project] #[pin_project]
pub struct ResponseFuture<T, E, R> pub struct ResponseFuture<S, E, Response>
where where
T: Service<crate::BatchControl<R>>, S: Service<crate::BatchControl<Response>>,
{ {
#[pin] #[pin]
state: ResponseState<T, E, R>, state: ResponseState<S, E, Response>,
} }
impl<T, E, R> Debug for ResponseFuture<T, E, R> impl<S, E, Response> Debug for ResponseFuture<S, E, Response>
where where
T: Service<crate::BatchControl<R>>, S: Service<crate::BatchControl<Response>>,
T::Future: Debug, S::Future: Debug,
T::Error: Debug, S::Error: Debug,
E: Debug, E: Debug,
{ {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@ -36,20 +36,20 @@ where
} }
#[pin_project(project = ResponseStateProj)] #[pin_project(project = ResponseStateProj)]
enum ResponseState<T, E, R> enum ResponseState<S, E, Response>
where where
T: Service<crate::BatchControl<R>>, S: Service<crate::BatchControl<Response>>,
{ {
Failed(Option<E>), Failed(Option<E>),
Rx(#[pin] message::Rx<T::Future, T::Error>), Rx(#[pin] message::Rx<S::Future, S::Error>),
Poll(#[pin] T::Future), Poll(#[pin] S::Future),
} }
impl<T, E, R> Debug for ResponseState<T, E, R> impl<S, E, Response> Debug for ResponseState<S, E, Response>
where where
T: Service<crate::BatchControl<R>>, S: Service<crate::BatchControl<Response>>,
T::Future: Debug, S::Future: Debug,
T::Error: Debug, S::Error: Debug,
E: Debug, E: Debug,
{ {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@ -61,11 +61,11 @@ where
} }
} }
impl<T, E, R> ResponseFuture<T, E, R> impl<S, E, Response> ResponseFuture<S, E, Response>
where where
T: Service<crate::BatchControl<R>>, S: Service<crate::BatchControl<Response>>,
{ {
pub(crate) fn new(rx: message::Rx<T::Future, T::Error>) -> Self { pub(crate) fn new(rx: message::Rx<S::Future, S::Error>) -> Self {
ResponseFuture { ResponseFuture {
state: ResponseState::Rx(rx), state: ResponseState::Rx(rx),
} }
@ -78,9 +78,9 @@ where
} }
} }
impl<S, E2, R> Future for ResponseFuture<S, E2, R> impl<S, E2, Response> Future for ResponseFuture<S, E2, Response>
where where
S: Service<crate::BatchControl<R>>, S: Service<crate::BatchControl<Response>>,
S::Future: Future<Output = Result<S::Response, S::Error>>, S::Future: Future<Output = Result<S::Response, S::Error>>,
S::Error: Into<E2>, S::Error: Into<E2>,
crate::error::Closed: Into<E2>, crate::error::Closed: Into<E2>,