pub struct Response<B = Body> { /* private fields */ }Expand description
An HTTP Response
Implementations§
Source§impl<B> Response<B>
impl<B> Response<B>
Sourcepub fn version(&self) -> HttpVersion
pub fn version(&self) -> HttpVersion
Get the HTTP version of this response.
Sourcepub fn headers_mut(&mut self) -> &mut Headers
pub fn headers_mut(&mut self) -> &mut Headers
Get a mutable reference to the headers.
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Get the status from the server.
Sourcepub fn set_status(&mut self, status: StatusCode)
pub fn set_status(&mut self, status: StatusCode)
Set the StatusCode for this response.
Sourcepub fn with_status(self, status: StatusCode) -> Response<B>
pub fn with_status(self, status: StatusCode) -> Response<B>
Set the status and move the Response.
Useful for the “builder-style” pattern.
Sourcepub fn with_header<H>(self, header: H) -> Response<B>where
H: Header,
pub fn with_header<H>(self, header: H) -> Response<B>where
H: Header,
Set a header and move the Response.
Useful for the “builder-style” pattern.
Sourcepub fn with_headers(self, headers: Headers) -> Response<B>
pub fn with_headers(self, headers: Headers) -> Response<B>
Set the headers and move the Response.
Useful for the “builder-style” pattern.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for Response<B>where
B: Freeze,
impl<B = Body> !RefUnwindSafe for Response<B>
impl<B> Send for Response<B>where
B: Send,
impl<B = Body> !Sync for Response<B>
impl<B> Unpin for Response<B>where
B: Unpin,
impl<B = Body> !UnwindSafe for Response<B>
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