From 42b0d53c16f318162fb7d71eeca60b672a908123 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 29 Aug 2018 21:31:43 -0700 Subject: [PATCH] change AndThen InitError constrain --- src/service/and_then.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/service/and_then.rs b/src/service/and_then.rs index 74d247ee..2d248667 100644 --- a/src/service/and_then.rs +++ b/src/service/and_then.rs @@ -126,6 +126,7 @@ impl NewService for AndThenNewService where A: NewService, A::Error: Into, + A::InitError: Into, B: NewService, { type Request = A::Request; @@ -133,7 +134,7 @@ where type Error = B::Error; type Service = AndThen; - type InitError = A::InitError; + type InitError = B::InitError; type Future = AndThenNewServiceFuture; fn new_service(&self) -> Self::Future { @@ -145,6 +146,7 @@ impl Clone for AndThenNewService where A: NewService + Clone, A::Error: Into, + A::InitError: Into, B: NewService + Clone, { fn clone(&self) -> Self { @@ -185,14 +187,15 @@ impl Future for AndThenNewServiceFuture where A: NewService, A::Error: Into, - B: NewService, + A::InitError: Into, + B: NewService, { type Item = AndThen; type Error = B::InitError; fn poll(&mut self) -> Poll { 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); } }