pub enum Either<A, B> {
Left(A),
Right(B),
}Expand description
Combines two different futures, streams, or sinks having the same associated types into a single type.
Variants§
Implementations§
Source§impl<T> Either<T, T>
impl<T> Either<T, T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Extract the value of an either over two equivalent types.
Trait Implementations§
impl<A: Copy, B: Copy> Copy for Either<A, B>
impl<A: Eq, B: Eq> Eq for Either<A, B>
Source§impl<A, B> Error for Either<A, B>
Either implements Error if both A and B implement it.
impl<A, B> Error for Either<A, B>
Either implements Error if both A and B implement it.
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl<A: Ord, B: Ord> Ord for Either<A, B>
impl<A: Ord, B: Ord> Ord for Either<A, B>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<A: PartialOrd, B: PartialOrd> PartialOrd for Either<A, B>
impl<A: PartialOrd, B: PartialOrd> PartialOrd for Either<A, B>
Source§impl<A, B, St, Req> Service<St, Req> for Either<A, B>
impl<A, B, St, Req> Service<St, Req> for Either<A, B>
Source§type Error = <A as Service<St, Req>>::Error
type Error = <A as Service<St, Req>>::Error
Errors produced by the service while checking readiness or executing a call.
Source§async fn call(
&self,
req: Req,
ctx: Ctx<'_, Self, St>,
) -> Result<Self::Res, Self::Error>
async fn call( &self, req: Req, ctx: Ctx<'_, Self, St>, ) -> Result<Self::Res, Self::Error>
Processes a request and asynchronously returns the response. Read more
Source§async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), Self::Error>
async fn ready(&self, ctx: Ctx<'_, Self, St>) -> Result<(), Self::Error>
Returns when the service is ready to process requests. Read more
Source§fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
fn map<F, Res>(self, f: F) -> ServiceChain<Map<F, Self, Res>, St, Req>
Maps this service’s output to a different type, returning a new service. Read more
Source§fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<F, Self, E>, St, Req>
Maps this service’s error to a different type, returning a new service. Read more
impl<A: PartialEq, B: PartialEq> StructuralPartialEq for Either<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Either<A, B>
impl<A, B> RefUnwindSafe for Either<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
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>where
A: UnsafeUnpin,
B: UnsafeUnpin,
impl<A, B> UnwindSafe for Either<A, B>where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more
Source§impl<S, St, Req> IntoService<S, St, Req> for Swhere
S: Service<St, Req>,
impl<S, St, Req> IntoService<S, St, Req> for Swhere
S: Service<St, Req>,
Source§fn into_service(self) -> S
fn into_service(self) -> S
Convert to a
Service