From 028279713eea66b7550330807872498d70636986 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 2 Oct 2018 21:31:11 -0700 Subject: [PATCH] simplify FnNewService --- src/service/fn_service.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/service/fn_service.rs b/src/service/fn_service.rs index 7a4e2284..e81ca642 100644 --- a/src/service/fn_service.rs +++ b/src/service/fn_service.rs @@ -71,16 +71,16 @@ where } } -pub struct FnNewService +pub struct FnNewService where F: Fn(Req) -> Fut, Fut: IntoFuture, { f: F, - _t: marker::PhantomData<(Req, Resp, Err, IErr)>, + _t: marker::PhantomData<(Req, Resp, Err)>, } -impl FnNewService +impl FnNewService where F: Fn(Req) -> Fut + Clone, Fut: IntoFuture, @@ -93,7 +93,7 @@ where } } -impl NewService for FnNewService +impl NewService for FnNewService where F: Fn(Req) -> Fut + Clone, Fut: IntoFuture, @@ -102,7 +102,7 @@ where type Response = Resp; type Error = Err; type Service = FnService; - type InitError = IErr; + type InitError = (); type Future = FutureResult; fn new_service(&self) -> Self::Future { @@ -110,18 +110,17 @@ where } } -impl IntoNewService> - for F +impl IntoNewService> for F where F: Fn(Req) -> Fut + Clone + 'static, Fut: IntoFuture, { - fn into_new_service(self) -> FnNewService { + fn into_new_service(self) -> FnNewService { FnNewService::new(self) } } -impl Clone for FnNewService +impl Clone for FnNewService where F: Fn(Req) -> Fut + Clone, Fut: IntoFuture,