pub struct ServiceResponse<B = Body> { /* private fields */ }Implementations§
Source§impl<B> ServiceResponse<B>
impl<B> ServiceResponse<B>
Sourcepub fn new(request: HttpRequest, response: Response<B>) -> ServiceResponse<B>
pub fn new(request: HttpRequest, response: Response<B>) -> ServiceResponse<B>
Create service response instance
Sourcepub fn from_err<E>(err: E, request: HttpRequest) -> ServiceResponse<B>
pub fn from_err<E>(err: E, request: HttpRequest) -> ServiceResponse<B>
Create service response from the error
Sourcepub fn error_response<E>(self, err: E) -> ServiceResponse<B>
pub fn error_response<E>(self, err: E) -> ServiceResponse<B>
Create service response for error
Sourcepub fn into_response<B1>(self, response: Response<B1>) -> ServiceResponse<B1>
pub fn into_response<B1>(self, response: Response<B1>) -> ServiceResponse<B1>
Create service response
Sourcepub fn request(&self) -> &HttpRequest
pub fn request(&self) -> &HttpRequest
Get reference to original request
Sourcepub fn response_mut(&mut self) -> &mut Response<B> ⓘ
pub fn response_mut(&mut self) -> &mut Response<B> ⓘ
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 checked_expr<F, E>(self, f: F) -> ServiceResponse<B>
pub fn checked_expr<F, E>(self, f: F) -> ServiceResponse<B>
Execute closure and in case of error convert it to response.
Sourcepub fn take_body(&mut self) -> ResponseBody<B>
pub fn take_body(&mut self) -> ResponseBody<B>
Extract response body
Source§impl<B> ServiceResponse<B>
impl<B> ServiceResponse<B>
Sourcepub fn map_body<F, B2>(self, f: F) -> ServiceResponse<B2>
pub fn map_body<F, B2>(self, f: F) -> ServiceResponse<B2>
Set a new body
Trait Implementations§
Source§impl<B> Debug for ServiceResponse<B>where
B: MessageBody,
impl<B> Debug for ServiceResponse<B>where
B: MessageBody,
Auto Trait Implementations§
impl<B = Body> !Freeze for ServiceResponse<B>
impl<B = Body> !RefUnwindSafe for ServiceResponse<B>
impl<B = Body> !Send for ServiceResponse<B>
impl<B = Body> !Sync for ServiceResponse<B>
impl<B> Unpin for ServiceResponse<B>where
B: Unpin,
impl<B = Body> !UnwindSafe for ServiceResponse<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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
Convert
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
Convert
&self to an expression for Diesel’s query builder. Read more