From f94ef5248ecf2febc699aeb0d28af3d3b9306f7c Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 16 Jan 2019 15:00:08 -0800 Subject: [PATCH] add Clone impl for Either service --- actix-utils/CHANGES.md | 4 ++++ actix-utils/src/either.rs | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/actix-utils/CHANGES.md b/actix-utils/CHANGES.md index 851d62b9..19eef1b7 100644 --- a/actix-utils/CHANGES.md +++ b/actix-utils/CHANGES.md @@ -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 diff --git a/actix-utils/src/either.rs b/actix-utils/src/either.rs index e5a23e49..54495005 100644 --- a/actix-utils/src/either.rs +++ b/actix-utils/src/either.rs @@ -12,6 +12,15 @@ pub enum EitherService { B(B), } +impl Clone for EitherService { + fn clone(&self) -> Self { + match self { + EitherService::A(srv) => EitherService::A(srv.clone()), + EitherService::B(srv) => EitherService::B(srv.clone()), + } + } +} + impl Service for EitherService where A: Service, @@ -61,6 +70,15 @@ where } } +impl Clone for Either { + 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, B: NewService, R> { A(A::Future),