From cfb62ccc402d7ea5d23276dccb538842878b46f6 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sun, 13 Jan 2019 22:58:23 -0800 Subject: [PATCH] Make Out::Error convertable from T::Error for apply combinator --- actix-service/CHANGES.md | 7 +++++++ actix-service/Cargo.toml | 2 +- actix-service/src/apply.rs | 13 +++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/actix-service/CHANGES.md b/actix-service/CHANGES.md index 47a5a46d..9b83cad4 100644 --- a/actix-service/CHANGES.md +++ b/actix-service/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.1.5] - 2019-01-13 + +### Changed + +* Make `Out::Error` convertable from `T::Error` for apply combinator + + ## [0.1.4] - 2019-01-11 ### Changed diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml index 6a5109a9..5dd02754 100644 --- a/actix-service/Cargo.toml +++ b/actix-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-service" -version = "0.1.4" +version = "0.1.5" authors = ["Nikolay Kim "] description = "Actix Service" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-service/src/apply.rs b/actix-service/src/apply.rs index 2b9ebcb2..1eb1cc8e 100644 --- a/actix-service/src/apply.rs +++ b/actix-service/src/apply.rs @@ -19,6 +19,7 @@ where T: Service, F: Fn(In, &mut T) -> Out, Out: IntoFuture, + Out::Error: From, { /// Create new `Apply` combinator pub fn new>(service: I, f: F) -> Self { @@ -46,16 +47,17 @@ where impl Service for Apply where - T: Service, + T: Service, F: Fn(In, &mut T) -> Out, Out: IntoFuture, + Out::Error: From, { type Response = Out::Item; type Error = Out::Error; type Future = Out::Future; fn poll_ready(&mut self) -> Poll<(), Self::Error> { - self.service.poll_ready() + self.service.poll_ready().map_err(|e| e.into()) } fn call(&mut self, req: In) -> Self::Future { @@ -78,6 +80,7 @@ where T: NewService, F: Fn(In, &mut T::Service) -> Out, Out: IntoFuture, + Out::Error: From, { /// Create new `ApplyNewService` new service instance pub fn new>(service: F1, f: F) -> Self { @@ -92,7 +95,7 @@ where impl Clone for ApplyNewService where T: NewService + Clone, - F: Fn(Out, &mut T::Service) -> Out + Clone, + F: Fn(In, &mut T::Service) -> Out + Clone, Out: IntoFuture, { fn clone(&self) -> Self { @@ -106,9 +109,10 @@ where impl NewService for ApplyNewService where - T: NewService, + T: NewService, F: Fn(In, &mut T::Service) -> Out + Clone, Out: IntoFuture, + Out::Error: From, { type Response = Out::Item; type Error = Out::Error; @@ -153,6 +157,7 @@ where T: NewService, F: Fn(In, &mut T::Service) -> Out, Out: IntoFuture, + Out::Error: From, { type Item = Apply; type Error = T::InitError;