[−][src]Struct mini_async_http::ResponseBuilder
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
impl RefUnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Sync for ResponseBuilder
impl Unpin for ResponseBuilder
impl UnwindSafe for ResponseBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,