[−][src]Struct actix_web::dev::ServiceResponse
Methods
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>
[src]
Get reference to response
pub fn response_mut(&mut self) -> &mut Response<B>
[src]
Get mutable reference to response
pub fn checked_expr<F, E>(self, f: F) -> Self where
F: FnOnce(&mut Self) -> Result<(), E>,
E: Into<Error>,
[src]
F: FnOnce(&mut Self) -> Result<(), E>,
E: Into<Error>,
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]
F: FnOnce(&mut ResponseHead, ResponseBody<B>) -> ResponseBody<B2>,
Set a new body
Methods from Deref<Target = Response<B>>
pub fn head(&self) -> &ResponseHead
[src]
Http message part of the response
pub fn head_mut(&mut self) -> &mut ResponseHead
[src]
Mutable reference to a http message part of the response
pub fn error(&self) -> Option<&Error>
[src]
The source error
for this response
pub fn status(&self) -> StatusCode
[src]
Get the response status code
pub fn status_mut(&mut self) -> &mut StatusCode
[src]
Set the StatusCode
for this response
pub fn headers(&self) -> &HeaderMap<HeaderValue>
[src]
Get the headers from the response
pub fn headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>
[src]
Get a mutable reference to the headers
pub fn cookies(&self) -> CookieIter
[src]
Get an iterator for the cookies set by this response
pub fn add_cookie(&mut self, cookie: &Cookie) -> Result<(), Error>
[src]
Add a cookie to this response
pub fn del_cookie(&mut self, name: &str) -> usize
[src]
Remove all cookies with the given name from this response. Returns the number of cookies removed.
pub fn upgrade(&self) -> bool
[src]
Connection upgrade status
pub fn keep_alive(&self) -> bool
[src]
Keep-alive status for this connection
pub fn extensions(&self) -> Ref<Extensions>
[src]
Responses extensions
pub fn extensions_mut(&mut self) -> RefMut<Extensions>
[src]
Mutable reference to a the response's extensions
pub fn body(&self) -> &ResponseBody<B>
[src]
Get body os this response
pub fn take_body(&mut self) -> ResponseBody<B>
[src]
Extract response body
Trait Implementations
impl<B> Into<Response<B>> for ServiceResponse<B>
[src]
impl<B> DerefMut for ServiceResponse<B>
[src]
impl<B: MessageBody> Debug for ServiceResponse<B>
[src]
impl<B> Deref for ServiceResponse<B>
[src]
type Target = Response<B>
The resulting type after dereferencing.
fn deref(&self) -> &Response<B>
[src]
impl<B> IntoFuture for ServiceResponse<B>
[src]
type Item = ServiceResponse<B>
The item that the future may resolve with.
type Error = Error
The error that the future may resolve with.
type Future = FutureResult<ServiceResponse<B>, Error>
The future that this type can be converted into.
fn into_future(self) -> Self::Future
[src]
Auto Trait Implementations
impl<B = Body> !Send for ServiceResponse<B>
impl<B = Body> !Sync for ServiceResponse<B>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<F> IntoFuture for F where
F: Future,
[src]
F: Future,
type Future = F
The future that this type can be converted into.
type Item = <F as Future>::Item
The item that the future may resolve with.
type Error = <F as Future>::Error
The error that the future may resolve with.