mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-27 00:27:43 +02:00
add Clone impl for Either service
This commit is contained in:
@ -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),
|
||||
|
Reference in New Issue
Block a user