pub struct HttpResponseStream { /* private fields */ }Expand description
A response body stream returned by HttpClient::execute_stream.
Response metadata is available immediately after headers arrive. Body bytes are read on demand, so dropping this value cancels the in-flight response instead of buffering the remaining payload.
Implementations§
Source§impl HttpResponseStream
impl HttpResponseStream
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Return the HTTP status code received from the server.
Sourcepub fn status_text(&self) -> &str
pub fn status_text(&self) -> &str
Return the canonical status text received from the server.
Sourcepub fn headers(&self) -> &[(String, String)]
pub fn headers(&self) -> &[(String, String)]
Return the response headers captured before body streaming began.
Sourcepub fn header(&self, name: &str) -> Option<&String>
pub fn header(&self, name: &str) -> Option<&String>
Look up a response header without regard to ASCII case.
Sourcepub async fn next_chunk(&mut self) -> Option<Result<Bytes, String>>
pub async fn next_chunk(&mut self) -> Option<Result<Bytes, String>>
Read the next body chunk.
None means end-of-stream. Transport failures are returned as
Err(String) and do not get silently converted into an empty body.
Sourcepub fn into_stream(self) -> HttpBodyStream
pub fn into_stream(self) -> HttpBodyStream
Take ownership of the underlying body stream.
Sourcepub async fn collect(self) -> Result<HttpResponse, String>
pub async fn collect(self) -> Result<HttpResponse, String>
Collect the streamed body into the existing buffered response type.
Auto Trait Implementations§
impl !RefUnwindSafe for HttpResponseStream
impl !Sync for HttpResponseStream
impl !UnwindSafe for HttpResponseStream
impl Forget for HttpResponseStream
impl Freeze for HttpResponseStream
impl Send for HttpResponseStream
impl Unpin for HttpResponseStream
impl UnsafeUnpin for HttpResponseStream
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