pub struct ResponseBody<B = BoxBody> { /* private fields */ }Expand description
A unified response body type. Generic type is for custom pinned response body(type implement Stream).
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<T, E>(self) -> ResponseBody
pub fn into_boxed<T, 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
PinnedFieldsOf<__Origin<'__pin, B>>: Unpin,
Auto Trait Implementations§
impl<B = BoxBody> !Freeze for ResponseBody<B>
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