pub struct Response<'headers, 'buf> {
pub version: Option<u8>,
pub code: Option<u16>,
pub reason: Option<&'buf str>,
pub headers: &'headers mut [Header<'buf>],
}
Expand description
A parsed Response.
See Request
docs for explanation of optional values.
Fields§
§version: Option<u8>
The response minor version, such as 1
for HTTP/1.1
.
code: Option<u16>
The response code, such as 200
.
reason: Option<&'buf str>
The response reason-phrase, such as OK
.
Contains an empty string if the reason-phrase was missing or contained invalid characters.
headers: &'headers mut [Header<'buf>]
The response headers.
Implementations§
source§impl<'h, 'b> Response<'h, 'b>
impl<'h, 'b> Response<'h, 'b>
sourcepub fn new(headers: &'h mut [Header<'b>]) -> Response<'h, 'b>
pub fn new(headers: &'h mut [Header<'b>]) -> Response<'h, 'b>
Creates a new Response
using a slice of Header
s you have allocated.
sourcepub fn parse(&mut self, buf: &'b [u8]) -> Result<usize>
pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize>
Try to parse a buffer of bytes into this Response
.
pub(crate) fn parse_with_config( &mut self, buf: &'b [u8], config: &ParserConfig, ) -> Result<usize>
pub(crate) fn parse_with_config_and_uninit_headers( &mut self, buf: &'b [u8], config: &ParserConfig, headers: &'h mut [MaybeUninit<Header<'b>>], ) -> Result<usize>
Trait Implementations§
source§impl<'headers, 'buf> PartialEq for Response<'headers, 'buf>
impl<'headers, 'buf> PartialEq for Response<'headers, 'buf>
impl<'headers, 'buf> Eq for Response<'headers, 'buf>
impl<'headers, 'buf> StructuralPartialEq for Response<'headers, 'buf>
Auto Trait Implementations§
impl<'headers, 'buf> Freeze for Response<'headers, 'buf>
impl<'headers, 'buf> RefUnwindSafe for Response<'headers, 'buf>
impl<'headers, 'buf> Send for Response<'headers, 'buf>
impl<'headers, 'buf> Sync for Response<'headers, 'buf>
impl<'headers, 'buf> Unpin for Response<'headers, 'buf>
impl<'headers, 'buf> !UnwindSafe for Response<'headers, 'buf>
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