pub enum Either<A, B> {
    Left(A),
    Right(B),
}

Variants§

§

Left(A)

§

Right(B)

Implementations§

source§

impl<A, B> Either<A, B>

source

pub fn as_pin_ref(self: Pin<&Self>) -> Either<Pin<&A>, Pin<&B>>

Convert Pin<&Either<A, B>> to Either<Pin<&A>, Pin<&B>>, pinned projections of the inner variants.

source

pub fn as_pin_mut(self: Pin<&mut Self>) -> Either<Pin<&mut A>, Pin<&mut B>>

Convert Pin<&mut Either<A, B>> to Either<Pin<&mut A>, Pin<&mut B>>, pinned projections of the inner variants.

source§

impl<T> Either<T, T>

source

pub fn into_inner(self) -> T

Trait Implementations§

source§

impl<A: Clone, B: Clone> Clone for Either<A, B>

source§

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

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A: Debug, B: Debug> Debug for Either<A, B>

source§

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

Formats the value using the given formatter. Read more
source§

impl<A: Display, B: Display> Display for Either<A, B>

source§

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

Formats the value using the given formatter. Read more
source§

impl<A: Error, B: Error> Error for Either<A, B>

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl<C, F, FLA, FLB> FactoryLayer<C, F> for Either<FLA, FLB>
where FLA: FactoryLayer<C, F>, FLB: FactoryLayer<C, F>,

§

type Factory = Either<<FLA as FactoryLayer<C, F>>::Factory, <FLB as FactoryLayer<C, F>>::Factory>

source§

fn layer(&self, config: &C, inner: F) -> Self::Factory

source§

impl<A, B> Future for Either<A, B>
where A: Future, B: Future<Output = A::Output>,

§

type Output = <A as Future>::Output

The type of value produced on completion.
source§

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
source§

impl<A, B> MakeService for Either<A, B>
where A: MakeService, B: MakeService,

§

type Service = Either<<A as MakeService>::Service, <B as MakeService>::Service>

§

type Error = Either<<A as MakeService>::Error, <B as MakeService>::Error>

source§

fn make_via_ref( &self, old: Option<&Self::Service> ) -> Result<Self::Service, Self::Error>

source§

fn make(&self) -> Result<Self::Service, Self::Error>

source§

impl<A, B, R> Service<R> for Either<A, B>
where A: Service<R>, B: Service<R, Response = A::Response, Error = A::Error>,

§

type Response = <A as Service<R>>::Response

Responses given by the service.
§

type Error = <A as Service<R>>::Error

Errors produced by the service.
source§

fn call( &self, req: R ) -> impl Future<Output = Result<Self::Response, Self::Error>>

Process the request and return the response asynchronously.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T, Request, Response, E> BoxService<Request, Response, E> for T
where T: Service<Request, Response = Response, Error = E> + 'static, Request: 'static,

source§

fn into_boxed(self) -> BoxedService<Request, Response, E>

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<F> IntoFuture for F
where F: Future,

§

type Output = <F as Future>::Output

The output that the future will produce on completion.
§

type IntoFuture = F

Which kind of future are we turning this into?
source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
source§

impl<T> Param<T> for T
where T: Clone,

source§

fn param(&self) -> T

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.