diff --git a/actix-utils/src/either.rs b/actix-utils/src/either.rs index 54495005..272b1213 100644 --- a/actix-utils/src/either.rs +++ b/actix-utils/src/either.rs @@ -51,6 +51,34 @@ pub enum Either { B(B), } +impl Either { + pub fn new_a(srv: A) -> Self + where + A: NewService, + B: NewService< + Request, + Response = A::Response, + Error = A::Error, + InitError = A::InitError, + >, + { + Either::A(srv) + } + + pub fn new_b(srv: B) -> Self + where + A: NewService, + B: NewService< + Request, + Response = A::Response, + Error = A::Error, + InitError = A::InitError, + >, + { + Either::B(srv) + } +} + impl NewService for Either where A: NewService,