Struct httparse::Response

source ·
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>

source

pub fn new(headers: &'h mut [Header<'b>]) -> Response<'h, 'b>

Creates a new Response using a slice of Headers you have allocated.

source

pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize>

Try to parse a buffer of bytes into this Response.

Trait Implementations§

source§

impl<'headers, 'buf> Debug for Response<'headers, 'buf>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'headers, 'buf> PartialEq for Response<'headers, 'buf>

source§

fn eq(&self, other: &Response<'headers, 'buf>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'headers, 'buf> Eq for Response<'headers, 'buf>

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.