pub struct Response { /* private fields */ }Implementations§
Source§impl Response
impl Response
Sourcepub fn into_parts(self) -> (Parts, ResponseBody)
pub fn into_parts(self) -> (Parts, ResponseBody)
Consumes the response and returns a tuple containing the component parts of the response and the response body.
Sourcepub fn map<F, T>(self, map: F) -> Self
pub fn map<F, T>(self, map: F) -> Self
Consumes the response returning a new response with body mapped to the
return type of the provided closure map.
pub fn body(&self) -> &ResponseBody
pub fn body_mut(&mut self) -> &mut ResponseBody
Returns a reference to the response cookies.
Returns a mutable reference to the response cookies.
pub fn headers(&self) -> &HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Sourcepub fn set_header(&mut self, name: HeaderName, value: HeaderValue)
pub fn set_header(&mut self, name: HeaderName, value: HeaderValue)
A shorthand method for self.headers_mut().insert(name, value).
pub fn status(&self) -> StatusCode
pub fn status_mut(&mut self) -> &mut StatusCode
Sourcepub fn set_status(&mut self, status: StatusCode)
pub fn set_status(&mut self, status: StatusCode)
A shorthand method for *self.status_mut() = status.
pub fn version(&self) -> Version
Source§impl Response
impl Response
pub fn new(body: ResponseBody) -> Self
pub fn build() -> ResponseBuilder
pub fn html(body: String) -> Self
pub fn text(body: String) -> Self
pub fn json<T>(body: &T) -> Result<Response, Error>where
T: Serialize,
Sourcepub fn stream<T, E>(body: T) -> Self
pub fn stream<T, E>(body: T) -> Self
Create a response from a stream of Result<Frame<Bytes>, Error>.
pub fn from_parts(parts: Parts, body: ResponseBody) -> Self
Sourcepub fn bad_request() -> Self
pub fn bad_request() -> Self
Sourcepub fn payment_required() -> Self
pub fn payment_required() -> Self
Sourcepub fn method_not_allowed() -> Self
pub fn method_not_allowed() -> Self
Sourcepub fn not_acceptable() -> Self
pub fn not_acceptable() -> Self
Sourcepub fn proxy_authentication_required() -> Self
pub fn proxy_authentication_required() -> Self
Sourcepub fn request_timeout() -> Self
pub fn request_timeout() -> Self
Sourcepub fn length_required() -> Self
pub fn length_required() -> Self
Sourcepub fn precondition_failed() -> Self
pub fn precondition_failed() -> Self
Sourcepub fn payload_too_large() -> Self
pub fn payload_too_large() -> Self
Sourcepub fn uri_too_long() -> Self
pub fn uri_too_long() -> Self
Sourcepub fn unsupported_media_type() -> Self
pub fn unsupported_media_type() -> Self
Sourcepub fn range_not_satisfiable() -> Self
pub fn range_not_satisfiable() -> Self
Sourcepub fn expectation_failed() -> Self
pub fn expectation_failed() -> Self
Sourcepub fn im_a_teapot() -> Self
pub fn im_a_teapot() -> Self
Sourcepub fn misdirected_request() -> Self
pub fn misdirected_request() -> Self
Sourcepub fn unprocessable_entity() -> Self
pub fn unprocessable_entity() -> Self
Sourcepub fn failed_dependency() -> Self
pub fn failed_dependency() -> Self
Sourcepub fn upgrade_required() -> Self
pub fn upgrade_required() -> Self
Sourcepub fn precondition_required() -> Self
pub fn precondition_required() -> Self
Sourcepub fn too_many_requests() -> Self
pub fn too_many_requests() -> Self
Sourcepub fn request_header_fields_too_large() -> Self
pub fn request_header_fields_too_large() -> Self
Sourcepub fn internal_server_error() -> Self
pub fn internal_server_error() -> Self
Sourcepub fn not_implemented() -> Self
pub fn not_implemented() -> Self
Sourcepub fn bad_gateway() -> Self
pub fn bad_gateway() -> Self
Sourcepub fn gateway_timeout() -> Self
pub fn gateway_timeout() -> Self
Sourcepub fn http_version_not_supported() -> Self
pub fn http_version_not_supported() -> Self
Sourcepub fn variant_also_negotiates() -> Self
pub fn variant_also_negotiates() -> Self
Sourcepub fn insufficient_storage() -> Self
pub fn insufficient_storage() -> Self
Sourcepub fn loop_detected() -> Self
pub fn loop_detected() -> Self
Sourcepub fn not_extended() -> Self
pub fn not_extended() -> Self
Sourcepub fn network_authentication_required() -> Self
pub fn network_authentication_required() -> Self
Trait Implementations§
Source§impl From<Response<ResponseBody>> for Response
impl From<Response<ResponseBody>> for Response
Source§fn from(response: Response<ResponseBody>) -> Self
fn from(response: Response<ResponseBody>) -> Self
Converts to this type from the input type.
Source§impl IntoResponse for Response
impl IntoResponse for Response
Auto Trait Implementations§
impl Freeze for Response
impl !RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more