diff --git a/src/service/and_then.rs b/src/service/and_then.rs
index 5b0a65f3..ef3a3114 100644
--- a/src/service/and_then.rs
+++ b/src/service/and_then.rs
@@ -26,6 +26,19 @@ where
}
}
+impl Clone for AndThen
+where
+ A: Service + Clone,
+ B: Service,
+{
+ fn clone(&self) -> Self {
+ AndThen {
+ a: self.a.clone(),
+ b: self.b.clone(),
+ }
+ }
+}
+
impl Service for AndThen
where
A: Service,
diff --git a/src/service/apply.rs b/src/service/apply.rs
index 58755f6f..0c29b81c 100644
--- a/src/service/apply.rs
+++ b/src/service/apply.rs
@@ -27,6 +27,22 @@ where
}
}
+impl Clone for Apply
+where
+ T: Service + Clone,
+ T::Error: Into<::Error>,
+ F: Fn(Req, &mut T) -> R + Clone,
+ R: IntoFuture,
+{
+ fn clone(&self) -> Self {
+ Apply {
+ service: self.service.clone(),
+ f: self.f.clone(),
+ r: PhantomData,
+ }
+ }
+}
+
impl Service for Apply
where
T: Service,
diff --git a/src/service/fn_state_service.rs b/src/service/fn_state_service.rs
index 4a76ee36..8b44ce44 100644
--- a/src/service/fn_state_service.rs
+++ b/src/service/fn_state_service.rs
@@ -33,6 +33,23 @@ where
}
}
+impl Clone for FnStateService
+where
+ S: Clone,
+ F: Fn(&mut S, Req) -> Fut + Clone,
+ Fut: IntoFuture- ,
+{
+ fn clone(&self) -> Self {
+ FnStateService {
+ f: self.f.clone(),
+ state: self.state.clone(),
+ req: marker::PhantomData,
+ resp: marker::PhantomData,
+ err: marker::PhantomData,
+ }
+ }
+}
+
impl
Service for FnStateService
where
F: Fn(&mut S, Req) -> Fut,
diff --git a/src/service/map.rs b/src/service/map.rs
index ac2cb480..9fa2acf6 100644
--- a/src/service/map.rs
+++ b/src/service/map.rs
@@ -25,11 +25,24 @@ where
}
}
+impl Clone for Map
+where
+ A: Service + Clone,
+ F: Fn(A::Response) -> R + Clone,
+{
+ fn clone(&self) -> Self {
+ Map {
+ a: self.a.clone(),
+ f: self.f.clone(),
+ r: marker::PhantomData,
+ }
+ }
+}
+
impl Service for Map
where
A: Service,
- F: Fn(A::Response) -> R,
- F: Clone,
+ F: Fn(A::Response) -> R + Clone,
{
type Request = A::Request;
type Response = R;
diff --git a/src/service/map_err.rs b/src/service/map_err.rs
index bf519980..b05b635a 100644
--- a/src/service/map_err.rs
+++ b/src/service/map_err.rs
@@ -25,6 +25,20 @@ where
}
}
+impl Clone for MapErr
+where
+ A: Service + Clone,
+ F: Fn(A::Error) -> E + Clone,
+{
+ fn clone(&self) -> Self {
+ MapErr {
+ a: self.a.clone(),
+ f: self.f.clone(),
+ e: marker::PhantomData,
+ }
+ }
+}
+
impl Service for MapErr
where
A: Service,