Enum Either
pub enum Either<A, B>
Combine two different service types into a single type.
Both services must be of the same request, response, and error types.
Either is useful for handling conditional branching in service middleware
to different inner service types.
Variants
-
Left(A) -
Right(B)
Trait Implementations
impl<A, B, Request> Service<Request> for Either<A, B>
where
A: Service<Request>,
B: Service<Request, Response = A::Response, Error = A::Error>,
type Response = <A as Service<Request>>::Response;type Error = <A as Service<Request>>::Error;type Future = EitherResponseFuture<<A as Service<Request>>::Future, <B as Service<Request>>::Future>;fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn call(&mut self, request: Request) -> Self::Future
impl<A: Clone, B: Clone> Clone for Either<A, B>
fn clone(&self) -> Self
impl<A: Copy, B: Copy> Copy for Either<A, B>
impl<A: Debug, B: Debug> Debug for Either<A, B>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<S, A, B> Layer<S> for Either<A, B>
where
A: Layer<S>,
B: Layer<S>,
type Service = Either<<A as Layer<S>>::Service, <B as Layer<S>>::Service>;fn layer(&self, inner: S) -> Self::Service