pub enum ResponseBody<B> {
Body(B),
Other(Body),
}Expand description
Response body preserving either a concrete body type or a type-erased body.
Variants§
Implementations§
Source§impl ResponseBody<Body>
impl ResponseBody<Body>
Sourcepub fn into_body<B>(self) -> ResponseBody<B>
pub fn into_body<B>(self) -> ResponseBody<B>
Converts a type-erased response body to another concrete response type.
Source§impl<B> ResponseBody<B>
impl<B> ResponseBody<B>
Sourcepub fn take_body(&mut self) -> ResponseBody<B>
pub fn take_body(&mut self) -> ResponseBody<B>
Replaces this response body with Body::None and returns the original.
Source§impl<B: MessageBody> ResponseBody<B>
impl<B: MessageBody> ResponseBody<B>
Sourcepub fn as_ref(&self) -> Option<&B>
pub fn as_ref(&self) -> Option<&B>
Returns the concrete body, if this is ResponseBody::Body.
Trait Implementations§
Source§impl<B: Debug> Debug for ResponseBody<B>
impl<B: Debug> Debug for ResponseBody<B>
Source§impl<B> From<Body> for ResponseBody<B>
impl<B> From<Body> for ResponseBody<B>
Source§impl From<ResponseBody<Body>> for Body
impl From<ResponseBody<Body>> for Body
Source§fn from(b: ResponseBody<Body>) -> Self
fn from(b: ResponseBody<Body>) -> Self
Converts to this type from the input type.
Source§impl<B: MessageBody> MessageBody for ResponseBody<B>
impl<B: MessageBody> MessageBody for ResponseBody<B>
Source§impl<B: MessageBody + Unpin> Stream for ResponseBody<B>
impl<B: MessageBody + Unpin> Stream for ResponseBody<B>
Auto Trait Implementations§
impl<B> !RefUnwindSafe for ResponseBody<B>
impl<B> !Send for ResponseBody<B>
impl<B> !Sync for ResponseBody<B>
impl<B> !UnwindSafe for ResponseBody<B>
impl<B> Forget for ResponseBody<B>
impl<B> Freeze for ResponseBody<B>where
B: Freeze,
impl<B> Unpin for ResponseBody<B>where
B: Unpin,
impl<B> UnsafeUnpin for ResponseBody<B>where
B: UnsafeUnpin,
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