From c1c989034de84b880cd1cffe903a8b6032720b17 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 25 Jan 2019 14:31:27 -0800 Subject: [PATCH] Added Clone impl for Timeout service factory --- actix-service/src/apply.rs | 8 ++++---- actix-utils/CHANGES.md | 2 ++ actix-utils/src/timeout.rs | 12 ++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/actix-service/src/apply.rs b/actix-service/src/apply.rs index 89d6559f..8a73c19e 100644 --- a/actix-service/src/apply.rs +++ b/actix-service/src/apply.rs @@ -78,7 +78,7 @@ where impl ApplyNewService where T: NewService, - F: FnMut(In, &mut T::Service) -> Out, + F: FnMut(In, &mut T::Service) -> Out + Clone, Out: IntoFuture, Out::Error: From, { @@ -129,7 +129,7 @@ where pub struct ApplyNewServiceFuture where T: NewService, - F: FnMut(In, &mut T::Service) -> Out, + F: FnMut(In, &mut T::Service) -> Out + Clone, Out: IntoFuture, { fut: T::Future, @@ -140,7 +140,7 @@ where impl ApplyNewServiceFuture where T: NewService, - F: FnMut(In, &mut T::Service) -> Out, + F: FnMut(In, &mut T::Service) -> Out + Clone, Out: IntoFuture, { fn new(fut: T::Future, f: F) -> Self { @@ -155,7 +155,7 @@ where impl Future for ApplyNewServiceFuture where T: NewService, - F: FnMut(In, &mut T::Service) -> Out, + F: FnMut(In, &mut T::Service) -> Out + Clone, Out: IntoFuture, Out::Error: From, { diff --git a/actix-utils/CHANGES.md b/actix-utils/CHANGES.md index 19eef1b7..df941106 100644 --- a/actix-utils/CHANGES.md +++ b/actix-utils/CHANGES.md @@ -6,6 +6,8 @@ * Added Clone impl for Either service +* Added Clone impl for Timeout service factory + * Added Service and NewService for Stream dispatcher diff --git a/actix-utils/src/timeout.rs b/actix-utils/src/timeout.rs index 8a18b1ac..d2e638ad 100644 --- a/actix-utils/src/timeout.rs +++ b/actix-utils/src/timeout.rs @@ -43,6 +43,18 @@ impl Timeout { } } +impl Clone for Timeout +where + T: Clone, +{ + fn clone(&self) -> Self { + Timeout { + inner: self.inner.clone(), + timeout: self.timeout, + } + } +} + impl NewService for Timeout where T: NewService + Clone,