pub struct ResponseBuilder { /* private fields */ }
Expand description
Build a response
Implementations§
Source§impl ResponseBuilder
impl ResponseBuilder
pub fn new() -> Self
Sourcepub fn empty_500() -> Self
pub fn empty_500() -> Self
Set the builer to build a response with an empty body and 500 status code
Sourcepub fn empty_200() -> Self
pub fn empty_200() -> Self
Set the builer to build a response with an empty body and 200 status code
Sourcepub fn empty_400() -> Self
pub fn empty_400() -> Self
Set the builer to build a response with an empty body and 400 status code
Sourcepub fn content_type(self, content_type: &str) -> Self
pub fn content_type(self, content_type: &str) -> Self
Set the “Content_Type” header of the response
Sourcepub fn status(self, status: Reason) -> Self
pub fn status(self, status: Reason) -> Self
Set the status of the response (code + reason phrase)
Sourcepub fn build(self) -> Result<Response, BuildError>
pub fn build(self) -> Result<Response, BuildError>
Build the response from the provided information If some informations are missing, BuildError will occur
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResponseBuilder
impl RefUnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Sync for ResponseBuilder
impl Unpin for ResponseBuilder
impl UnwindSafe for ResponseBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more