Enum xitca_http::body::ResponseBody
source · pub enum ResponseBody<B = BoxBody> {
None,
Bytes {
bytes: Bytes,
},
Stream {
stream: B,
},
}Expand description
A unified response body type. Generic type is for custom pinned response body(type implement Stream).
Variants§
Implementations§
source§impl ResponseBody
impl ResponseBody
source§impl<B> ResponseBody<B>
impl<B> ResponseBody<B>
sourcepub const fn none() -> Self
pub const fn none() -> Self
indicate no body is attached to response.
content-length and transfer-encoding headers would not be added to
response when BodySize is used for inferring response body type.
sourcepub const fn empty() -> Self
pub const fn empty() -> Self
indicate empty body is attached to response.
content-length: 0 header would be added to response when BodySize is
used for inferring response body type.
sourcepub fn into_boxed<E>(self) -> ResponseBody
pub fn into_boxed<E>(self) -> ResponseBody
erase generic body type by boxing the variant.
Trait Implementations§
source§impl<B> Default for ResponseBody<B>
impl<B> Default for ResponseBody<B>
source§impl<B> From<&'static [u8]> for ResponseBody<B>
impl<B> From<&'static [u8]> for ResponseBody<B>
source§impl<B> From<&'static str> for ResponseBody<B>
impl<B> From<&'static str> for ResponseBody<B>
source§impl From<BoxBody> for ResponseBody
impl From<BoxBody> for ResponseBody
source§impl<B> From<Bytes> for ResponseBody<B>
impl<B> From<Bytes> for ResponseBody<B>
source§impl<B> From<BytesMut> for ResponseBody<B>
impl<B> From<BytesMut> for ResponseBody<B>
source§impl<B> From<NoneBody<B>> for ResponseBody
impl<B> From<NoneBody<B>> for ResponseBody
source§impl<B> From<Once<B>> for ResponseBody
impl<B> From<Once<B>> for ResponseBody
source§impl<B> From<String> for ResponseBody<B>
impl<B> From<String> for ResponseBody<B>
source§impl<B, E> Stream for ResponseBody<B>
impl<B, E> Stream for ResponseBody<B>
impl<'__pin, B> Unpin for ResponseBody<B>where
__Origin<'__pin, B>: Unpin,
Auto Trait Implementations§
impl<B> RefUnwindSafe for ResponseBody<B>where
B: RefUnwindSafe,
impl<B> Send for ResponseBody<B>where
B: Send,
impl<B> Sync for ResponseBody<B>where
B: Sync,
impl<B> UnwindSafe for ResponseBody<B>where
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