Struct jwt_actix::ServiceResponse [−]
pub struct ServiceResponse<B = BoxBody> { /* fields omitted */ }
Expand description
A service level response wrapper.
Implementations
impl ServiceResponse<BoxBody>
impl ServiceResponse<BoxBody>
pub fn from_err<E>(err: E, request: HttpRequest) -> ServiceResponse<BoxBody> where
E: Into<Error>,
pub fn from_err<E>(err: E, request: HttpRequest) -> ServiceResponse<BoxBody> where
E: Into<Error>,
Create service response from the error
impl<B> ServiceResponse<B>
impl<B> ServiceResponse<B>
pub fn new(
request: HttpRequest,
response: HttpResponse<B>
) -> ServiceResponse<B>
pub fn new(
request: HttpRequest,
response: HttpResponse<B>
) -> ServiceResponse<B>
Create service response instance
pub fn error_response<E>(self, err: E) -> ServiceResponse<BoxBody> where
E: Into<Error>,
pub fn error_response<E>(self, err: E) -> ServiceResponse<BoxBody> where
E: Into<Error>,
Create service response for error
pub fn into_response<B1>(
self,
response: HttpResponse<B1>
) -> ServiceResponse<B1>
pub fn into_response<B1>(
self,
response: HttpResponse<B1>
) -> ServiceResponse<B1>
Create service response
pub fn request(&self) -> &HttpRequest
pub fn request(&self) -> &HttpRequest
Returns reference to original request.
pub fn response(&self) -> &HttpResponse<B>
pub fn response(&self) -> &HttpResponse<B>
Returns reference to response.
pub fn response_mut(&mut self) -> &mut HttpResponse<B>
pub fn response_mut(&mut self) -> &mut HttpResponse<B>
Returns mutable reference to response.
pub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns response status code.
pub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
Returns response’s headers.
pub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Returns mutable response’s headers.
pub fn into_parts(self) -> (HttpRequest, HttpResponse<B>)
pub fn into_parts(self) -> (HttpRequest, HttpResponse<B>)
Destructures ServiceResponse
into request and response components.
pub fn map_body<F, B2>(self, f: F) -> ServiceResponse<B2> where
F: FnOnce(&mut ResponseHead, B) -> B2,
pub fn map_body<F, B2>(self, f: F) -> ServiceResponse<B2> where
F: FnOnce(&mut ResponseHead, B) -> B2,
Map the current body type to another using a closure. Returns a new response.
Closure receives the response head and the current body type.
pub fn map_into_left_body<R>(self) -> ServiceResponse<EitherBody<B, R>>
pub fn map_into_right_body<L>(self) -> ServiceResponse<EitherBody<L, B>>
pub fn map_into_boxed_body(self) -> ServiceResponse<BoxBody> where
B: MessageBody + 'static,
pub fn into_body(self) -> B
pub fn into_body(self) -> B
Consumes the response and returns its body.
Trait Implementations
Auto Trait Implementations
impl<B = BoxBody> !RefUnwindSafe for ServiceResponse<B>
impl<B = BoxBody> !Send for ServiceResponse<B>
impl<B = BoxBody> !Sync for ServiceResponse<B>
impl<B> Unpin for ServiceResponse<B> where
B: Unpin,
impl<B = BoxBody> !UnwindSafe for ServiceResponse<B>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more