From 2c1f8f0b96aa8726d0233aa5f352c954255a3ab9 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 12 Mar 2019 13:50:14 -0700 Subject: [PATCH] enforce constraints on AndThenNewService type --- actix-service/src/and_then.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/actix-service/src/and_then.rs b/actix-service/src/and_then.rs index ee0f5e18..5dbc343e 100644 --- a/actix-service/src/and_then.rs +++ b/actix-service/src/and_then.rs @@ -107,19 +107,23 @@ where } /// `AndThenNewService` new service combinator -pub struct AndThenNewService { +pub struct AndThenNewService +where + A: NewService, + B: NewService, +{ a: A, b: B, _t: PhantomData, } -impl AndThenNewService { +impl AndThenNewService +where + A: NewService, + B: NewService, +{ /// Create new `AndThen` combinator - pub fn new>(a: A, f: F) -> Self - where - A: NewService, - B: NewService, - { + pub fn new>(a: A, f: F) -> Self { Self { a, b: f.into_new_service(), @@ -148,8 +152,8 @@ where impl Clone for AndThenNewService where - A: Clone, - B: Clone, + A: NewService + Clone, + B: NewService + Clone, { fn clone(&self) -> Self { Self {