via::response

Struct Response

Source
pub struct Response { /* private fields */ }

Implementations§

Source§

impl Response

Source

pub fn into_parts(self) -> (Parts, HttpBody<BufferBody>)

Consumes the response and returns a tuple containing the component parts of the response and the response body.

Source

pub fn map<F>(self, map: F) -> Self

Consumes the response returning a new response with body mapped to the return type of the provided closure map.

Source

pub fn body(&self) -> &HttpBody<BufferBody>

Source

pub fn body_mut(&mut self) -> &mut HttpBody<BufferBody>

Source

pub fn cookies(&self) -> Option<&CookieJar>

Returns a reference to the response cookies.

Source

pub fn cookies_mut(&mut self) -> &mut CookieJar

Returns a mutable reference to the response cookies.

Source

pub fn headers(&self) -> &HeaderMap

Source

pub fn headers_mut(&mut self) -> &mut HeaderMap

Source

pub fn status(&self) -> StatusCode

Source

pub fn status_mut(&mut self) -> &mut StatusCode

Source

pub fn version(&self) -> Version

Source§

impl Response

Source

pub fn new(body: HttpBody<BufferBody>) -> Self

Source

pub fn build() -> ResponseBuilder

Source

pub fn from_parts(parts: Parts, body: HttpBody<BufferBody>) -> Self

Source

pub fn bad_request() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 400 Bad Request status.

Source

pub fn unauthorized() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 401 Unauthorized status.

Source

pub fn payment_required() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 402 Payment Required status.

Source

pub fn forbidden() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 403 Forbidden status.

Source

pub fn not_found() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 404 Not Found status.

Source

pub fn method_not_allowed() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 405 Method Not Allowed status.

Source

pub fn not_acceptable() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 406 Not Acceptable status.

Source

pub fn proxy_authentication_required() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 407 Proxy Authentication Required status.

Source

pub fn request_timeout() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 408 Request Timeout status.

Source

pub fn conflict() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 409 Conflict status.

Source

pub fn gone() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 410 Gone status.

Source

pub fn length_required() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 411 Length Required status.

Source

pub fn precondition_failed() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 412 Precondition Failed status.

Source

pub fn payload_too_large() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 413 Payload Too Large status.

Source

pub fn uri_too_long() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 414 URI Too Long status.

Source

pub fn unsupported_media_type() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 415 Unsupported Media Type status.

Source

pub fn range_not_satisfiable() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 416 Range Not Satisfiable status.

Source

pub fn expectation_failed() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 417 Expectation Failed status.

Source

pub fn im_a_teapot() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 418 I'm a teapot status.

Source

pub fn misdirected_request() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 421 Misdirected Request status.

Source

pub fn unprocessable_entity() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 422 Unprocessable Entity status.

Source

pub fn locked() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 423 Locked status.

Source

pub fn failed_dependency() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 424 Failed Dependency status.

Source

pub fn upgrade_required() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 426 Upgrade Required status.

Source

pub fn precondition_required() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 428 Precondition Required status.

Source

pub fn too_many_requests() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 429 Too Many Requests status.

Source

pub fn request_header_fields_too_large() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 431 Request Header Fields Too Large status.

Returns a new Error from the provided source that will generate a Response with a 451 Unavailable For Legal Reasons status.

Source

pub fn internal_server_error() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 500 Internal Server Error status.

Source

pub fn not_implemented() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 501 Not Implemented status.

Source

pub fn bad_gateway() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 502 Bad Gateway status.

Source

pub fn service_unavailable() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 503 Service Unavailable status.

Source

pub fn gateway_timeout() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 504 Gateway Timeout status.

Source

pub fn http_version_not_supported() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 505 HTTP Version Not Supported status.

Source

pub fn variant_also_negotiates() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 506 Variant Also Negotiates status.

Source

pub fn insufficient_storage() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 507 Insufficient Storage status.

Source

pub fn loop_detected() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 508 Loop Detected status.

Source

pub fn not_extended() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 510 Not Extended status.

Source

pub fn network_authentication_required() -> Result<Self, Error>

Returns a new Error from the provided source that will generate a Response with a 511 Network Authentication Required status.

Trait Implementations§

Source§

impl Debug for Response

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Response

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Error> for Response

Source§

fn from(error: Error) -> Response

Converts to this type from the input type.
Source§

impl IntoResponse for Response

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.