pub struct WebResponse { /* private fields */ }Expand description
An http service response.
Implementations§
Source§impl WebResponse
impl WebResponse
Sourcepub fn new(response: Response<Body>, request: HttpRequest) -> Self
pub fn new(response: Response<Body>, request: HttpRequest) -> Self
Create web response instance.
Sourcepub fn from_err<St>(
st: &St,
err: &impl WebResponseError<St, St::Error>,
request: HttpRequest,
) -> Selfwhere
St: State,
pub fn from_err<St>(
st: &St,
err: &impl WebResponseError<St, St::Error>,
request: HttpRequest,
) -> Selfwhere
St: State,
Create web response from the error.
Sourcepub fn error_response<St>(
self,
st: &St,
err: &impl WebResponseError<St, St::Error>,
) -> Selfwhere
St: State,
pub fn error_response<St>(
self,
st: &St,
err: &impl WebResponseError<St, St::Error>,
) -> Selfwhere
St: State,
Create web response for error.
Sourcepub fn into_response(self, response: Response) -> WebResponse
pub fn into_response(self, response: Response) -> WebResponse
Create web response.
Sourcepub fn request(&self) -> &HttpRequest
pub fn request(&self) -> &HttpRequest
Get reference to original request.
Sourcepub fn response_mut(&mut self) -> &mut Response<Body>
pub fn response_mut(&mut self) -> &mut Response<Body>
Get mutable reference to response.
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Get the response status code.
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Returns mutable response’s headers.
Sourcepub fn take_body(&mut self) -> ResponseBody<Body>
pub fn take_body(&mut self) -> ResponseBody<Body>
Extract response body.
Sourcepub fn map_body<F>(self, f: F) -> WebResponse
pub fn map_body<F>(self, f: F) -> WebResponse
Set a new body.
Sourcepub fn into_parts(self) -> (Response<Body>, HttpRequest)
pub fn into_parts(self) -> (Response<Body>, HttpRequest)
Destruct response into parts.
Trait Implementations§
Source§impl Debug for WebResponse
impl Debug for WebResponse
Auto Trait Implementations§
impl !RefUnwindSafe for WebResponse
impl !Send for WebResponse
impl !Sync for WebResponse
impl !UnwindSafe for WebResponse
impl Freeze for WebResponse
impl Unpin for WebResponse
impl UnsafeUnpin for WebResponse
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