pub struct ResponseBody<B = BoxBody> { /* private fields */ }Expand description
A unified response body type. Generic type is for custom pinned response body(type implement Body).
Implementations§
Source§impl ResponseBody
impl ResponseBody
Source§impl<B> ResponseBody<B>
impl<B> ResponseBody<B>
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, E> Body for ResponseBody<B>
impl<B, E> Body for ResponseBody<B>
Source§type Data = Bytes
type Data = Bytes
The payload data type yielded by
Frame::Data variants.Source§fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Bytes>, E>>>
fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Bytes>, E>>>
Attempt to pull the next frame from the body. Read more
Source§fn is_end_stream(&self) -> bool
fn is_end_stream(&self) -> bool
Indicates whether the body has been fully consumed. Read more
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<String> for ResponseBody<B>
impl<B> From<String> 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> UnsafeUnpin for ResponseBody<B>where
B: UnsafeUnpin,
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