Enum Either

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)

Implementations

impl<A, B> Freeze for Either<A, B>

impl<A, B> RefUnwindSafe for Either<A, B>

impl<A, B> Send for Either<A, B>

impl<A, B> Sync for Either<A, B>

impl<A, B> Unpin for Either<A, B>

impl<A, B> UnsafeUnpin for Either<A, B>

impl<A, B> UnwindSafe for Either<A, B>

impl<A, B, Request> Service for Either<A, B>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>
fn call(self: &mut Self, request: Request) -> <Self as >::Future

impl<A: $crate::clone::Clone, B: $crate::clone::Clone> Clone for Either<A, B>

fn clone(self: &Self) -> Either<A, B>

impl<A: $crate::fmt::Debug, B: $crate::fmt::Debug> Debug for Either<A, B>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<A: $crate::marker::Copy, B: $crate::marker::Copy> Copy for Either<A, B>

impl<M, S, Target, Request> MakeService for Either<A, B>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future

impl<S, A, B> Layer for Either<A, B>

fn layer(self: &Self, inner: S) -> <Self as >::Service

impl<T> Any for Either<A, B>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Either<A, B>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Either<A, B>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Either<A, B>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Either<A, B>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Either<A, B>

impl<T> ToOwned for Either<A, B>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> WithSubscriber for Either<A, B>

impl<T, Request> ServiceExt for Either<A, B>

impl<T, U> Into for Either<A, B>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Either<A, B>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Either<A, B>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>