pub enum Either<L, R> {
Left(L),
Right(R),
}
Expand description
Sum type with two cases: Left
and Right
, used if a body can be one of
two distinct types.
Variants§
Implementations§
Trait Implementations§
source§impl<L, R, Data> Body for Either<L, R>where
L: HttpBody<Data = Data>,
R: HttpBody<Data = Data>,
L::Error: Into<Box<dyn Error + Send + Sync>>,
R::Error: Into<Box<dyn Error + Send + Sync>>,
Data: Buf,
impl<L, R, Data> Body for Either<L, R>where L: HttpBody<Data = Data>, R: HttpBody<Data = Data>, L::Error: Into<Box<dyn Error + Send + Sync>>, R::Error: Into<Box<dyn Error + Send + Sync>>, Data: Buf,
source§fn poll_data(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Option<Result<Self::Data, Self::Error>>>
fn poll_data( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Option<Result<Self::Data, Self::Error>>>
Attempt to pull out the next data buffer of this stream.
source§fn poll_trailers(
self: Pin<&mut Self>,
cx: &mut Context<'_>
) -> Poll<Result<Option<HeaderMap>, Self::Error>>
fn poll_trailers( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<Option<HeaderMap>, Self::Error>>
Poll for an optional single
HeaderMap
of trailers. Read moresource§fn is_end_stream(&self) -> bool
fn is_end_stream(&self) -> bool
Returns
true
when the end of stream has been reached. Read moresource§fn size_hint(&self) -> SizeHint
fn size_hint(&self) -> SizeHint
Returns the bounds on the remaining length of the stream. Read more
impl<L: Copy, R: Copy> Copy for Either<L, R>
impl<'__pin, L, R> Unpin for Either<L, R>where __Origin<'__pin, L, R>: Unpin,
Auto Trait Implementations§
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> UnwindSafe for Either<L, R>where L: UnwindSafe, R: 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