[][src]Struct actix_web::dev::ServiceResponse

pub struct ServiceResponse<B = Body> { /* fields omitted */ }

Implementations

impl<B> ServiceResponse<B>[src]

pub fn new(request: HttpRequest, response: Response<B>) -> Self[src]

Create service response instance

pub fn from_err<E: Into<Error>>(err: E, request: HttpRequest) -> Self[src]

Create service response from the error

pub fn error_response<E: Into<Error>>(self, err: E) -> Self[src]

Create service response for error

pub fn into_response<B1>(self, response: Response<B1>) -> ServiceResponse<B1>[src]

Create service response

pub fn request(&self) -> &HttpRequest[src]

Get reference to original request

pub fn response(&self) -> &Response<B>

Notable traits for Response<Body>

impl Future for Response<Body> type Output = Result<Response<Body>, Error>;
[src]

Get reference to response

pub fn response_mut(&mut self) -> &mut Response<B>

Notable traits for Response<Body>

impl Future for Response<Body> type Output = Result<Response<Body>, Error>;
[src]

Get mutable reference to response

pub fn status(&self) -> StatusCode[src]

Get the response status code

pub fn headers(&self) -> &HeaderMap[src]

Returns response's headers.

pub fn headers_mut(&mut self) -> &mut HeaderMap[src]

Returns mutable response's headers.

pub fn checked_expr<F, E>(self, f: F) -> Self where
    F: FnOnce(&mut Self) -> Result<(), E>,
    E: Into<Error>, 
[src]

Execute closure and in case of error convert it to response.

pub fn take_body(&mut self) -> ResponseBody<B>[src]

Extract response body

impl<B> ServiceResponse<B>[src]

pub fn map_body<F, B2>(self, f: F) -> ServiceResponse<B2> where
    F: FnOnce(&mut ResponseHead, ResponseBody<B>) -> ResponseBody<B2>, 
[src]

Set a new body

Trait Implementations

impl<B: MessageBody> Debug for ServiceResponse<B>[src]

impl<B> Into<Response<B>> for ServiceResponse<B>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,