Enum afire::Status

source ·
pub enum Status {
Show 54 variants Continue, SwitchingProtocols, EarlyHints, Ok, Created, Accepted, NonAuthoritativeInformation, NoContent, ResetContent, PartialContent, MultipleChoices, MovedPermanently, Found, SeeOther, NotModified, UseProxy, TemporaryRedirect, PermanentRedirect, BadRequest, Unauthorized, PaymentRequired, Forbidden, NotFound, MethodNotAllowed, NotAcceptable, ProxyAuthenticationRequired, RequestTimeOut, Conflict, Gone, LengthRequired, PreconditionFailed, PayloadTooLarge, URITooLarge, UnsupportedMediaType, RangeNotSatisfiable, ExpectationFailed, ImaTeapot, MisdirectedRequest, TooEarly, UpgradeRequired, PreconditionRequired, TooManyRequests, RequestHeaderFieldsTooLarge, UnavailableForLegalReasons, InternalServerError, NotImplemented, BadGateway, ServiceUnavailable, GatewayTimeOut, HTTPVersionNotSupported, VariantAlsoNegotiates, NotExtended, NetworkAuthenticationRequired, Custom(u16),
}
Expand description

HTTP status codes. Used in crate::Request and crate::Response.

Used to indicate the status of an HTTP response. Note: Methods that accept a Status will also accept any u16 value, converting it to a Status::Custom if it is not a valid status code.

Supports Status:

  • 100-101
  • 200-206
  • 300-307
  • 400-417
  • 500-505

From https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Variants§

§

Continue

HTTP 100 Continue. MDN

§

SwitchingProtocols

HTTP 101 Switching Protocols. MDN

§

EarlyHints

HTTP 103 Early Hints. MDN

§

Ok

HTTP 200 OK. MDN

§

Created

HTTP 201 Created. MDN

§

Accepted

HTTP 202 Accepted. MDN

§

NonAuthoritativeInformation

HTTP 203 Non-Authoritative Information. MDN

§

NoContent

HTTP 204 No Content. MDN

§

ResetContent

HTTP 205 Reset Content. MDN

§

PartialContent

HTTP 206 Partial Content. MDN

§

MultipleChoices

HTTP 300 Multiple Choices. MDN

§

MovedPermanently

HTTP 301 Moved Permanently. MDN

§

Found

HTTP 302 Found. MDN

§

SeeOther

HTTP 303 See Other. MDN

§

NotModified

HTTP 304 Not Modified. MDN

§

UseProxy

HTTP 305 Use Proxy. MDN

§

TemporaryRedirect

HTTP 307 Temporary Redirect. MDN

§

PermanentRedirect

HTTP 308 Permanent Redirect. MDN

§

BadRequest

HTTP 400 Bad Request. MDN

§

Unauthorized

HTTP 401 Unauthorized. MDN

§

PaymentRequired

HTTP 402 Payment Required. MDN

§

Forbidden

HTTP 403 Forbidden. MDN

§

NotFound

HTTP 404 Not Found. MDN

§

MethodNotAllowed

HTTP 405 Method Not Allowed. MDN

§

NotAcceptable

HTTP 406 Not Acceptable. MDN

§

ProxyAuthenticationRequired

HTTP 407 Proxy Authentication Required. MDN

§

RequestTimeOut

HTTP 408 Request Time-out. MDN

§

Conflict

HTTP 409 Conflict. MDN

§

Gone

HTTP 410 Gone. MDN

§

LengthRequired

HTTP 411 Length Required. MDN

§

PreconditionFailed

HTTP 412 Precondition Failed. MDN

§

PayloadTooLarge

HTTP 413 Payload Too Large. MDN

§

URITooLarge

HTTP 414 URI Too Large. MDN

§

UnsupportedMediaType

HTTP 415 Unsupported Media Type. MDN

§

RangeNotSatisfiable

HTTP 416 Range Not Satisfiable. MDN

§

ExpectationFailed

HTTP 417 Expectation Failed. MDN

§

ImaTeapot

HTTP 418 I’m a teapot. MDN

§

MisdirectedRequest

HTTP 421 Misdirected Request. MDN

§

TooEarly

HTTP 425 Too Early. MDN

§

UpgradeRequired

HTTP 426 Upgrade Required. MDN

§

PreconditionRequired

HTTP 428 Precondition Required. MDN

§

TooManyRequests

HTTP 429 Too Many Requests. MDN

§

RequestHeaderFieldsTooLarge

HTTP 431 Request Header Fields Too Large. MDN

§

UnavailableForLegalReasons

HTTP 451 Unavailable For Legal Reasons. MDN

§

InternalServerError

HTTP 500 Internal Server Error. MDN

§

NotImplemented

HTTP 501 Not Implemented. MDN

§

BadGateway

HTTP 502 Bad Gateway. MDN

§

ServiceUnavailable

HTTP 503 Service Unavailable. MDN

§

GatewayTimeOut

HTTP 504 Gateway Time-out. MDN

§

HTTPVersionNotSupported

HTTP 505 HTTP Version Not Supported. MDN

§

VariantAlsoNegotiates

HTTP 506 Variant Also Negotiates. MDN

§

NotExtended

HTTP 510 Not Extended. MDN

§

NetworkAuthenticationRequired

HTTP 511 Network Authentication Required. MDN

§

Custom(u16)

Custom status code

Implementations§

source§

impl Status

source

pub fn code(&self) -> u16

Gets the actual HTTP status code for the status.

source

pub fn reason_phrase(&self) -> &str

Gets the default reason phrase for the status. For responses you can use the crate::Response::reason method to set a custom reason phrase.

Trait Implementations§

source§

impl Clone for Status

source§

fn clone(&self) -> Status

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Status

source§

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

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

impl From<u16> for Status

source§

fn from(code: u16) -> Self

Converts to this type from the input type.
source§

impl Hash for Status

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Status

source§

fn cmp(&self, other: &Status) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Status> for Status

source§

fn eq(&self, other: &Status) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Status> for Status

source§

fn partial_cmp(&self, other: &Status) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for Status

source§

impl Eq for Status

source§

impl StructuralEq for Status

source§

impl StructuralPartialEq for Status

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.