Struct actix_web::dev::ServiceResponse  
source · [−]pub struct ServiceResponse<B = BoxBody> { /* private fields */ }Expand description
A service level response wrapper.
Implementations
sourceimpl ServiceResponse<BoxBody>
 
impl ServiceResponse<BoxBody>
sourcepub fn from_err<E: Into<Error>>(err: E, request: HttpRequest) -> Self
 
pub fn from_err<E: Into<Error>>(err: E, request: HttpRequest) -> Self
Create service response from the error
sourceimpl<B> ServiceResponse<B>
 
impl<B> ServiceResponse<B>
sourcepub fn new(request: HttpRequest, response: HttpResponse<B>) -> Self
 
pub fn new(request: HttpRequest, response: HttpResponse<B>) -> Self
Create service response instance
sourcepub fn error_response<E: Into<Error>>(self, err: E) -> ServiceResponse
 
pub fn error_response<E: Into<Error>>(self, err: E) -> ServiceResponse
Create service response for error
sourcepub fn into_response<B1>(
    self, 
    response: HttpResponse<B1>
) -> ServiceResponse<B1>
 
pub fn into_response<B1>(
    self, 
    response: HttpResponse<B1>
) -> ServiceResponse<B1>
Create service response
sourcepub fn request(&self) -> &HttpRequest
 
pub fn request(&self) -> &HttpRequest
Get reference to original request
sourcepub fn response(&self) -> &HttpResponse<B>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
 
pub fn response(&self) -> &HttpResponse<B>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
Get reference to response
sourcepub fn response_mut(&mut self) -> &mut HttpResponse<B>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
 
pub fn response_mut(&mut self) -> &mut HttpResponse<B>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
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 into_parts(self) -> (HttpRequest, HttpResponse<B>)
 
pub fn into_parts(self) -> (HttpRequest, HttpResponse<B>)
Destructures ServiceResponse into request and response components.
sourcepub 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, 
Set a new body
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, 
Trait Implementations
sourceimpl<B> Debug for ServiceResponse<B> where
    B: MessageBody,
    B::Error: Into<Error>, 
 
impl<B> Debug for ServiceResponse<B> where
    B: MessageBody,
    B::Error: Into<Error>, 
sourceimpl<B> From<ServiceResponse<B>> for HttpResponse<B>
 
impl<B> From<ServiceResponse<B>> for HttpResponse<B>
sourcefn from(res: ServiceResponse<B>) -> HttpResponse<B>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
 
fn from(res: ServiceResponse<B>) -> HttpResponse<B>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
Converts to this type from the input type.
sourceimpl<B> From<ServiceResponse<B>> for Response<B>
 
impl<B> From<ServiceResponse<B>> for Response<B>
sourcefn from(res: ServiceResponse<B>) -> Response<B>
 
fn from(res: ServiceResponse<B>) -> Response<B>
Converts to this type from the input type.
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
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
 
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
 
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
 
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
 
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
