pub struct ResponseBody { /* private fields */ }Expand description
Incoming response frames. Completion or abandonment is reported to the client driver; response reads do not drive request upload or socket I/O.
A pending read can be dropped without losing a frame, so reads can race other futures such as a command channel or timer. See polling reads alongside other I/O.
Trait Implementations§
Source§impl Drop for ResponseBody
impl Drop for ResponseBody
Source§impl ReadableBody for ResponseBody
impl ReadableBody for ResponseBody
type Error = BodyError
Source§fn is_ready(&self) -> bool
fn is_ready(&self) -> bool
Whether another read can proceed without waiting for produced data. Read more
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Whether no unread payload frames remain. False can mean unknown; an open
queue with no frames is not exhausted. This does not suppress read errors.
Source§fn length(&self) -> Option<u64>
fn length(&self) -> Option<u64>
Total representation length, independent of the current read position.
Source§fn may_have_trailers(&self) -> bool
fn may_have_trailers(&self) -> bool
Whether this body can emit trailing headers. An HTTP/1.1 response needs
this before reading to choose chunked framing, even when the data length
is known. An HTTP/1 request of known length uses
Content-Length and
drops any trailers whatever this reports. Returning false promises that
no Headers frame will be produced.Source§fn close(&mut self, error: Option<BodyError>)
fn close(&mut self, error: Option<BodyError>)
Abandon further application reads, optionally reporting their failure. Read more
Source§async fn read(
&mut self,
cancellation: &Cancellation,
) -> Result<BodyFrame<Vec<u8>>, BodyError>
async fn read( &mut self, cancellation: &Cancellation, ) -> Result<BodyFrame<Vec<u8>>, BodyError>
Read one owned frame. Pre-cancellation prevents consumption. The caller
stops after
frame.is_end(); subsequent reads return BodyFrame::End.
Headers occur at most once, after all data. Dropping a pending read is
not transport retirement, and must not lose an unreturned queued frame. Read morefn is_rewindable(&self) -> bool
Auto Trait Implementations§
impl Freeze for ResponseBody
impl RefUnwindSafe for ResponseBody
impl Send for ResponseBody
impl Sync for ResponseBody
impl Unpin for ResponseBody
impl UnsafeUnpin for ResponseBody
impl UnwindSafe for ResponseBody
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