pub struct Response(/* private fields */);Expand description
A request in flight; dropping it cancels it.
Implementations§
Source§impl Response
impl Response
pub fn state(&self) -> State
Sourcepub fn status(&self) -> i32
pub fn status(&self) -> i32
HTTP status (after redirects), 0 before the headers or after a failure.
Sourcepub fn headers(&self) -> Option<Vec<(String, String)>>
pub fn headers(&self) -> Option<Vec<(String, String)>>
Response headers (names lowercase), once they are in.
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Option<usize>
pub fn read(&mut self, buf: &mut [u8]) -> Option<usize>
Body bytes that have arrived: Some(n) copied (0: none yet), None when the
body is done and drained or the request failed.
Sourcepub fn read_to_end(&mut self) -> Vec<u8> ⓘ
pub fn read_to_end(&mut self) -> Vec<u8> ⓘ
Everything that has arrived so far (all of it once the state is State::Done).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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