pub struct Response {
pub status_code: StatusCode,
/* private fields */
}
Expand description
An HTTP response
Fields§
§status_code: StatusCode
Implementations§
Source§impl Response
impl Response
Sourcepub fn body_read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub fn body_read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read a response body in a streaming fashion.
buf
is an arbitrary large buffer, that may be partially filled after each call.
The function returns the actual number of bytes that were written, and 0
when the end of the stream has been reached.
Sourcepub fn body_read_all(&mut self) -> Result<Vec<u8>, Error>
pub fn body_read_all(&mut self) -> Result<Vec<u8>, Error>
Read the entire body until the end of the stream.
Sourcepub fn header_get(&self, name: String) -> Result<String, Error>
pub fn header_get(&self, name: String) -> Result<String, Error>
Get the value of the name
header.
Returns HttpError::HeaderNotFound
if no such header was found.
Sourcepub fn headers_get_all(&self) -> Result<HeaderMap, Error>
pub fn headers_get_all(&self) -> Result<HeaderMap, Error>
Get the entire response header map for a given request.
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 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