httparse

Struct 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>,

Source§

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>,

Source§

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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes