Enum Either
pub enum Either<L, R>
Sum type with two cases: Left and Right, used if a body can be one of
two distinct types.
Variants
-
Left(L) A value of type
L-
Right(R) A value of type
R
Implementations
impl<L> Either<L, L>
fn into_inner(self) -> LConvert
Eitherinto the inner type, if bothLeftandRightare of the same type.
Trait Implementations
impl<'__pin, L, R> Unpin for Either<L, R>
where
__Origin<'__pin, L, R>: Unpin,
impl<L, R, Data> Body for Either<L, R>
where
L: Body<Data = Data>,
R: Body<Data = Data>,
L::Error: Into<Box<dyn Error + Send + Sync>>,
R::Error: Into<Box<dyn Error + Send + Sync>>,
Data: Buf,
type Data = Data;type Error = Box<dyn Error + Sync + Send>;fn poll_frame(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>fn is_end_stream(&self) -> boolfn size_hint(&self) -> SizeHint
impl<L: Clone, R: Clone> Clone for Either<L, R>
fn clone(&self) -> Self
impl<L: Copy, R: Copy> Copy for Either<L, R>
impl<L: Debug, R: Debug> Debug for Either<L, R>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<L, R> Freeze for Either<L, R>
where
L: Freeze,
R: Freeze,
impl<L, R> RefUnwindSafe for Either<L, R>
where
L: RefUnwindSafe,
R: RefUnwindSafe,
impl<L, R> Send for Either<L, R>
where
L: Send,
R: Send,
impl<L, R> Sync for Either<L, R>
where
L: Sync,
R: Sync,
impl<L, R> UnsafeUnpin for Either<L, R>
where
L: UnsafeUnpin,
R: UnsafeUnpin,
impl<L, R> UnwindSafe for Either<L, R>
where
L: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for Either<L, R>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> BodyExt for Either<L, R>
where
T: Body + ?Sized,
impl<T> Borrow<T> for Either<L, R>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Either<L, R>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Either<L, R>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Either<L, R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Either<L, R>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Either<L, R>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Either<L, R>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Either<L, R>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>