1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 18:02:58 +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
* Added Clone impl for Either service
* Added Service and NewService for Stream dispatcher
## [0.1.0] - 2018-12-09

View File

@ -12,6 +12,15 @@ pub enum EitherService<A, 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>
where
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)]
pub enum EitherNewService<A: NewService<R>, B: NewService<R>, R> {
A(A::Future),