Skip to content

Commit

Permalink
NewRequest -> R1, OldRequest -> R2 for generics
Browse files Browse the repository at this point in the history
  • Loading branch information
hlbarber committed Jul 15, 2020
1 parent 2a245fb commit 0c18eb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tower/src/util/combinators/try_with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ impl<S, F> TryWith<S, F> {
}
}

impl<S, F, NewRequest, OldRequest> Service<NewRequest> for TryWith<S, F>
impl<S, F, R1, R2> Service<R1> for TryWith<S, F>
where
S: Service<OldRequest>,
F: FnOnce(NewRequest) -> Result<OldRequest, S::Error> + Clone,
S: Service<R2>,
F: FnOnce(R1) -> Result<R2, S::Error> + Clone,
{
type Response = S::Response;
type Error = S::Error;
Expand All @@ -32,7 +32,7 @@ where
self.inner.poll_ready(cx)
}

fn call(&mut self, request: NewRequest) -> Self::Future {
fn call(&mut self, request: R1) -> Self::Future {
match (self.f.clone())(request) {
Ok(ok) => Either::Left(self.inner.call(ok)),
Err(err) => Either::Right(ready(Err(err))),
Expand Down
8 changes: 4 additions & 4 deletions tower/src/util/combinators/with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ impl<S, F> With<S, F> {
}
}

impl<S, F, NewRequest, OldRequest> Service<NewRequest> for With<S, F>
impl<S, F, R1, R2> Service<R1> for With<S, F>
where
S: Service<OldRequest>,
F: FnOnce(NewRequest) -> OldRequest + Clone,
S: Service<R2>,
F: FnOnce(R1) -> R2 + Clone,
{
type Response = S::Response;
type Error = S::Error;
Expand All @@ -31,7 +31,7 @@ where
self.inner.poll_ready(cx)
}

fn call(&mut self, request: NewRequest) -> S::Future {
fn call(&mut self, request: R1) -> S::Future {
self.inner.call((self.f.clone())(request))
}
}
Expand Down

0 comments on commit 0c18eb9

Please sign in to comment.