1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 23:42:56 +01:00

Added Clone impl for Timeout service factory

This commit is contained in:
Nikolay Kim 2019-01-25 14:31:27 -08:00
parent 515bfad830
commit c1c989034d
3 changed files with 18 additions and 4 deletions

View File

@ -78,7 +78,7 @@ where
impl<T, F, In, Out, Request> ApplyNewService<T, F, In, Out, Request> impl<T, F, In, Out, Request> ApplyNewService<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: FnMut(In, &mut T::Service) -> Out + Clone,
Out: IntoFuture, Out: IntoFuture,
Out::Error: From<T::Error>, Out::Error: From<T::Error>,
{ {
@ -129,7 +129,7 @@ where
pub struct ApplyNewServiceFuture<T, F, In, Out, Request> pub struct ApplyNewServiceFuture<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: FnMut(In, &mut T::Service) -> Out + Clone,
Out: IntoFuture, Out: IntoFuture,
{ {
fut: T::Future, fut: T::Future,
@ -140,7 +140,7 @@ where
impl<T, F, In, Out, Request> ApplyNewServiceFuture<T, F, In, Out, Request> impl<T, F, In, Out, Request> ApplyNewServiceFuture<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: FnMut(In, &mut T::Service) -> Out + Clone,
Out: IntoFuture, Out: IntoFuture,
{ {
fn new(fut: T::Future, f: F) -> Self { fn new(fut: T::Future, f: F) -> Self {
@ -155,7 +155,7 @@ where
impl<T, F, In, Out, Request> Future for ApplyNewServiceFuture<T, F, In, Out, Request> impl<T, F, In, Out, Request> Future for ApplyNewServiceFuture<T, F, In, Out, Request>
where where
T: NewService<Request>, T: NewService<Request>,
F: FnMut(In, &mut T::Service) -> Out, F: FnMut(In, &mut T::Service) -> Out + Clone,
Out: IntoFuture, Out: IntoFuture,
Out::Error: From<T::Error>, Out::Error: From<T::Error>,
{ {

View File

@ -6,6 +6,8 @@
* Added Clone impl for Either service * Added Clone impl for Either service
* Added Clone impl for Timeout service factory
* Added Service and NewService for Stream dispatcher * Added Service and NewService for Stream dispatcher

View File

@ -43,6 +43,18 @@ impl<T> Timeout<T> {
} }
} }
impl<T> Clone for Timeout<T>
where
T: Clone,
{
fn clone(&self) -> Self {
Timeout {
inner: self.inner.clone(),
timeout: self.timeout,
}
}
}
impl<T, Request> NewService<Request> for Timeout<T> impl<T, Request> NewService<Request> for Timeout<T>
where where
T: NewService<Request> + Clone, T: NewService<Request> + Clone,