ResponseBody

Struct ResponseBody 

Source
pub struct ResponseBody<'resp, 'buf, C>
where C: Read,
{ pub body_buf: &'buf mut [u8], /* private fields */ }
Expand description

Response body

This type contains the original header buffer provided to read_headers, now renamed to body_buf, the number of read body bytes that are available in body_buf, and a reader to be used for reading the remaining body.

Fields§

§body_buf: &'buf mut [u8]

The buffer initially provided to read the header.

Implementations§

Source§

impl<'resp, 'buf, C> ResponseBody<'resp, 'buf, C>
where C: Read,

Source

pub fn reader(self) -> BodyReader<BufferingReader<'resp, 'buf, C>>

Source§

impl<'resp, 'buf, C> ResponseBody<'resp, 'buf, C>
where C: Read + TryBufRead,

Source

pub async fn read_to_end(self) -> Result<&'buf mut [u8], Error>

Read the entire body into the buffer originally provided Response::read(). This requires that this original buffer is large enough to contain the entire body.

Source

pub async fn discard(self) -> Result<usize, Error>

Discard the entire body

Returns the number of discarded body bytes

Auto Trait Implementations§

§

impl<'resp, 'buf, C> Freeze for ResponseBody<'resp, 'buf, C>

§

impl<'resp, 'buf, C> RefUnwindSafe for ResponseBody<'resp, 'buf, C>
where C: RefUnwindSafe,

§

impl<'resp, 'buf, C> Send for ResponseBody<'resp, 'buf, C>
where C: Send,

§

impl<'resp, 'buf, C> Sync for ResponseBody<'resp, 'buf, C>
where C: Sync,

§

impl<'resp, 'buf, C> Unpin for ResponseBody<'resp, 'buf, C>

§

impl<'resp, 'buf, C> !UnwindSafe for ResponseBody<'resp, 'buf, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V