[][src]Struct mini_async_http::ResponseBuilder

pub struct ResponseBuilder { /* fields omitted */ }

Build a response

Implementations

impl ResponseBuilder[src]

pub fn new() -> Self[src]

pub fn empty_500() -> Self[src]

Set the builer to build a response with an empty body and 500 status code

pub fn empty_200() -> Self[src]

Set the builer to build a response with an empty body and 200 status code

pub fn empty_400() -> Self[src]

Set the builer to build a response with an empty body and 400 status code

pub fn code(self, code: i32) -> Self[src]

Set the the status code of the response

pub fn reason(self, reason: String) -> Self[src]

Set the reason of the response

pub fn version(self, version: Version) -> Self[src]

Set the HTTP version of the response

pub fn headers(self, headers: Headers) -> Self[src]

Set the header object for the response

pub fn header(self, key: &str, value: &str) -> Self[src]

Set a single header for the response

pub fn content_type(self, content_type: &str) -> Self[src]

Set the "Content_Type" header of the response

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

Set the body as a byte slice of the response

pub fn status(self, status: Reason) -> Self[src]

Set the status of the response (code + reason phrase)

pub fn build(self) -> Result<Response, BuildError>[src]

Build the response from the provided information If some informations are missing, BuildError will occur

Trait Implementations

impl Default for ResponseBuilder[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.

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.