pub struct HttpResponse<'a> {
pub version: &'a str,
pub status_code: u16,
pub reason: &'a str,
pub headers: Vec<(&'a str, &'a str)>,
pub body_offset: usize,
}Expand description
A parsed HTTP/1.x response.
All string fields are lifetimed references back into the buffer that was
passed to HttpResponse::parse. The body_offset field records where
the body begins in that same buffer.
Fields§
§version: &'a strHTTP version string (e.g. "HTTP/1.1").
status_code: u16Numeric status code (e.g. 200, 404).
reason: &'a strReason phrase from the status line (e.g. "OK", "Not Found").
headers: Vec<(&'a str, &'a str)>Parsed headers as (name, value) pairs. Header names retain their
original casing from the wire; callers should compare case-insensitively.
body_offset: usizeByte offset in the original buffer at which the message body starts.
Points to the byte immediately after the blank line (\r\n\r\n) that
separates headers from body. When there is no body this equals the
buffer length.
Implementations§
Trait Implementations§
Source§impl<'a> Clone for HttpResponse<'a>
impl<'a> Clone for HttpResponse<'a>
Source§fn clone(&self) -> HttpResponse<'a>
fn clone(&self) -> HttpResponse<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for HttpResponse<'a>
impl<'a> RefUnwindSafe for HttpResponse<'a>
impl<'a> Send for HttpResponse<'a>
impl<'a> Sync for HttpResponse<'a>
impl<'a> Unpin for HttpResponse<'a>
impl<'a> UnsafeUnpin for HttpResponse<'a>
impl<'a> UnwindSafe for HttpResponse<'a>
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