1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-22 16:16:40 +00:00

change AndThen InitError constrain

This commit is contained in:
Nikolay Kim 2018-08-29 21:31:43 -07:00
parent 9b48e952b8
commit 42b0d53c16

View file

@ -126,6 +126,7 @@ impl<A, B> NewService for AndThenNewService<A, B>
where
A: NewService<Response = B::Request, InitError = B::InitError>,
A::Error: Into<B::Error>,
A::InitError: Into<B::InitError>,
B: NewService,
{
type Request = A::Request;
@ -133,7 +134,7 @@ where
type Error = B::Error;
type Service = AndThen<A::Service, B::Service>;
type InitError = A::InitError;
type InitError = B::InitError;
type Future = AndThenNewServiceFuture<A, B>;
fn new_service(&self) -> Self::Future {
@ -145,6 +146,7 @@ impl<A, B> Clone for AndThenNewService<A, B>
where
A: NewService<Response = B::Request, InitError = B::InitError> + Clone,
A::Error: Into<B::Error>,
A::InitError: Into<B::InitError>,
B: NewService + Clone,
{
fn clone(&self) -> Self {
@ -185,14 +187,15 @@ impl<A, B> Future for AndThenNewServiceFuture<A, B>
where
A: NewService,
A::Error: Into<B::Error>,
B: NewService<Request = A::Response, InitError = A::InitError>,
A::InitError: Into<B::InitError>,
B: NewService<Request = A::Response>,
{
type Item = AndThen<A::Service, B::Service>;
type Error = B::InitError;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if self.a.is_none() {
if let Async::Ready(service) = self.fut_a.poll()? {
if let Async::Ready(service) = self.fut_a.poll().map_err(|e| e.into())? {
self.a = Some(service);
}
}