1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-23 00:26:34 +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 where
A: NewService<Response = B::Request, InitError = B::InitError>, A: NewService<Response = B::Request, InitError = B::InitError>,
A::Error: Into<B::Error>, A::Error: Into<B::Error>,
A::InitError: Into<B::InitError>,
B: NewService, B: NewService,
{ {
type Request = A::Request; type Request = A::Request;
@ -133,7 +134,7 @@ where
type Error = B::Error; type Error = B::Error;
type Service = AndThen<A::Service, B::Service>; type Service = AndThen<A::Service, B::Service>;
type InitError = A::InitError; type InitError = B::InitError;
type Future = AndThenNewServiceFuture<A, B>; type Future = AndThenNewServiceFuture<A, B>;
fn new_service(&self) -> Self::Future { fn new_service(&self) -> Self::Future {
@ -145,6 +146,7 @@ impl<A, B> Clone for AndThenNewService<A, B>
where where
A: NewService<Response = B::Request, InitError = B::InitError> + Clone, A: NewService<Response = B::Request, InitError = B::InitError> + Clone,
A::Error: Into<B::Error>, A::Error: Into<B::Error>,
A::InitError: Into<B::InitError>,
B: NewService + Clone, B: NewService + Clone,
{ {
fn clone(&self) -> Self { fn clone(&self) -> Self {
@ -185,14 +187,15 @@ impl<A, B> Future for AndThenNewServiceFuture<A, B>
where where
A: NewService, A: NewService,
A::Error: Into<B::Error>, 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 Item = AndThen<A::Service, B::Service>;
type Error = B::InitError; type Error = B::InitError;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> { fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
if self.a.is_none() { 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); self.a = Some(service);
} }
} }