1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-24 01:11:07 +01:00

add Clone impl for Either service

This commit is contained in:
Nikolay Kim 2019-01-16 15:00:08 -08:00
parent cbc378b67f
commit f94ef5248e
2 changed files with 22 additions and 0 deletions

View File

@ -4,6 +4,10 @@
* Fix framed transport error handling * Fix framed transport error handling
* Added Clone impl for Either service
* Added Service and NewService for Stream dispatcher
## [0.1.0] - 2018-12-09 ## [0.1.0] - 2018-12-09

View File

@ -12,6 +12,15 @@ pub enum EitherService<A, B> {
B(B), B(B),
} }
impl<A: Clone, B: Clone> Clone for EitherService<A, B> {
fn clone(&self) -> Self {
match self {
EitherService::A(srv) => EitherService::A(srv.clone()),
EitherService::B(srv) => EitherService::B(srv.clone()),
}
}
}
impl<A, B, Request> Service<Request> for EitherService<A, B> impl<A, B, Request> Service<Request> for EitherService<A, B>
where where
A: Service<Request>, A: Service<Request>,
@ -61,6 +70,15 @@ where
} }
} }
impl<A: Clone, B: Clone> Clone for Either<A, B> {
fn clone(&self) -> Self {
match self {
Either::A(srv) => Either::A(srv.clone()),
Either::B(srv) => Either::B(srv.clone()),
}
}
}
#[doc(hidden)] #[doc(hidden)]
pub enum EitherNewService<A: NewService<R>, B: NewService<R>, R> { pub enum EitherNewService<A: NewService<R>, B: NewService<R>, R> {
A(A::Future), A(A::Future),