Struct stream_httparse::Response[][src]

pub struct Response<'a> { /* fields omitted */ }
Expand description

Represents a single HTTP-Request

Implementations

impl<'a> Response<'a>[src]

pub fn new(
    protocol: &'a str,
    status_code: StatusCode,
    headers: Headers<'a>,
    body: Vec<u8>
) -> Self
[src]

Creates a new Response with the given Data as its inital State

pub fn serialize(&self) -> (Vec<u8>, &[u8])[src]

Serialzes the Response and returns the Data as a tuple of form (HTTP-Head, HTTP-Body)

pub fn protocol(&self) -> &str[src]

Returns the Protocol of the Response

pub fn status_code(&self) -> &StatusCode[src]

Returns the StatusCode of the Response

pub fn headers(&self) -> &Headers<'a>[src]

Returns the Headers of the Response

pub fn body(&self) -> &[u8][src]

Returns the Body of the Response

pub fn add_header<'b, K, V>(&mut self, key: K, value: V) where
    'b: 'a,
    K: Into<HeaderKey<'a>>,
    V: Into<HeaderValue<'a>>, 
[src]

Adds the Key-Value Pair as a new Header to the Response or replaces the old Value of the Header if it already existed on the Response

pub fn set_body(&mut self, n_body: Vec<u8>)[src]

Replaces the old Body of the Response with the new given Body and updates the Content-Length Header as well with the new Length

pub fn is_chunked(&self) -> bool[src]

Checks if the Response is send using Transfer-Encoding: Chunked

pub fn to_owned<'refed, 'owned>(&'refed self) -> Response<'owned>[src]

Clones the entire Response to produce a new indepandent Response

Trait Implementations

impl<'a> Debug for Response<'a>[src]

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

Formats the value using the given formatter. Read more

impl<'a> PartialEq<Response<'a>> for Response<'a>[src]

fn eq(&self, other: &Response<'a>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Response<'a>) -> bool[src]

This method tests for !=.

impl<'a> StructuralPartialEq for Response<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Response<'a>

impl<'a> Send for Response<'a>

impl<'a> Sync for Response<'a>

impl<'a> Unpin for Response<'a>

impl<'a> UnwindSafe for Response<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.