Struct ajars_actix_web::actix_web::BaseHttpResponse [−]
pub struct BaseHttpResponse<B> { /* fields omitted */ }
Expand description
An HTTP response.
Implementations
pub fn new(status: StatusCode) -> Response<AnyBody>
pub fn new(status: StatusCode) -> Response<AnyBody>
Constructs a new response with default body.
pub fn build(status: StatusCode) -> ResponseBuilderⓘNotable traits for ResponseBuilderimpl Future for ResponseBuilder type Output = Result<Response<AnyBody>, Error>;
pub fn build(status: StatusCode) -> ResponseBuilderⓘNotable traits for ResponseBuilderimpl Future for ResponseBuilder type Output = Result<Response<AnyBody>, Error>;
impl Future for ResponseBuilder type Output = Result<Response<AnyBody>, Error>;
Constructs a new response builder.
pub fn bad_request() -> Response<AnyBody>
pub fn bad_request() -> Response<AnyBody>
Constructs a new response with status 400 Bad Request.
pub fn internal_server_error() -> Response<AnyBody>
pub fn internal_server_error() -> Response<AnyBody>
Constructs a new response with status 500 Internal Server Error.
impl<B> Response<B>
impl<B> Response<B>
pub fn with_body(status: StatusCode, body: B) -> Response<B>
pub fn with_body(status: StatusCode, body: B) -> Response<B>
Constructs a new response with given body.
pub fn head(&self) -> &ResponseHead
pub fn head(&self) -> &ResponseHead
Returns a reference to the head of this response.
pub fn head_mut(&mut self) -> &mut ResponseHead
pub fn head_mut(&mut self) -> &mut ResponseHead
Returns a mutable reference to the head of this response.
pub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns the status code of this response.
pub fn status_mut(&mut self) -> &mut StatusCode
pub fn status_mut(&mut self) -> &mut StatusCode
Returns a mutable reference the status code of this response.
pub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Returns a mutable reference to response headers.
pub fn keep_alive(&self) -> bool
pub fn keep_alive(&self) -> bool
Returns true if keep-alive is enabled.
pub fn extensions(&self) -> Ref<'_, Extensions>
pub fn extensions(&self) -> Ref<'_, Extensions>
Returns a reference to the extensions of this response.
pub fn extensions_mut(&mut self) -> RefMut<'_, Extensions>
pub fn extensions_mut(&mut self) -> RefMut<'_, Extensions>
Returns a mutable reference to the extensions of this response.
pub fn into_parts(self) -> (Response<()>, B)
pub fn into_parts(self) -> (Response<()>, B)
Returns split head and body.
Implementation Notes
Due to internal performance optimisations, the first element of the returned tuple is a
Response
as well but only contains the head of the response this was called on.
pub fn map_body<F, B2>(self, f: F) -> Response<B2> where
F: FnOnce(&mut ResponseHead, B) -> B2,
pub fn map_body<F, B2>(self, f: F) -> Response<B2> where
F: FnOnce(&mut ResponseHead, B) -> B2,
Returns new response with mapped body.
pub fn into_body(self) -> B
pub fn into_body(self) -> B
Returns body, consuming this response.
Trait Implementations
Get content encoding
Set content encoding Read more
impl<B> Debug for Response<B> where
B: MessageBody,
impl<B> Debug for Response<B> where
B: MessageBody,
Performs the conversion.
Performs the conversion.
impl From<Infallible> for Response<AnyBody>
impl From<Infallible> for Response<AnyBody>
pub fn from(val: Infallible) -> Response<AnyBody>
pub fn from(val: Infallible) -> Response<AnyBody>
Performs the conversion.
impl From<ParseError> for Response<AnyBody>
impl From<ParseError> for Response<AnyBody>
pub fn from(err: ParseError) -> Response<AnyBody>
pub fn from(err: ParseError) -> Response<AnyBody>
Performs the conversion.
impl From<Response<AnyBody>> for DispatchError
impl From<Response<AnyBody>> for DispatchError
pub fn from(original: Response<AnyBody>) -> DispatchError
pub fn from(original: Response<AnyBody>) -> DispatchError
Performs the conversion.
pub fn from(res: Response<B>) -> HttpResponse<B>ⓘNotable traits for HttpResponse<AnyBody>impl Future for HttpResponse<AnyBody> type Output = Result<Response<AnyBody>, Error>;
pub fn from(res: Response<B>) -> HttpResponse<B>ⓘNotable traits for HttpResponse<AnyBody>impl Future for HttpResponse<AnyBody> type Output = Result<Response<AnyBody>, Error>;
impl Future for HttpResponse<AnyBody> type Output = Result<Response<AnyBody>, Error>;
Performs the conversion.
impl<B> From<Response<B>> for ResponseBuilder
impl<B> From<Response<B>> for ResponseBuilder
Convert Response
to a ResponseBuilder
. Body get dropped.
pub fn from(res: Response<B>) -> ResponseBuilderⓘNotable traits for ResponseBuilderimpl Future for ResponseBuilder type Output = Result<Response<AnyBody>, Error>;
pub fn from(res: Response<B>) -> ResponseBuilderⓘNotable traits for ResponseBuilderimpl Future for ResponseBuilder type Output = Result<Response<AnyBody>, Error>;
impl Future for ResponseBuilder type Output = Result<Response<AnyBody>, Error>;
Performs the conversion.
impl From<ResponseBuilder> for Response<AnyBody>
impl From<ResponseBuilder> for Response<AnyBody>
pub fn from(builder: ResponseBuilder) -> Response<AnyBody>
pub fn from(builder: ResponseBuilder) -> Response<AnyBody>
Performs the conversion.
Performs the conversion.
pub fn respond_to(self, &HttpRequest) -> HttpResponse<AnyBody>ⓘNotable traits for HttpResponse<AnyBody>impl Future for HttpResponse<AnyBody> type Output = Result<Response<AnyBody>, Error>;
pub fn respond_to(self, &HttpRequest) -> HttpResponse<AnyBody>ⓘNotable traits for HttpResponse<AnyBody>impl Future for HttpResponse<AnyBody> type Output = Result<Response<AnyBody>, Error>;
impl Future for HttpResponse<AnyBody> type Output = Result<Response<AnyBody>, Error>;
Convert self to HttpResponse
.
Override a status code for a Responder. Read more
Insert header to the final response. Read more