StatusCode

Enum StatusCode 

Source
pub enum StatusCode {
Show 63 variants Continue, SwitchingProtocols, Processing, EarlyHints, Ok, Created, Accepted, NonAuthoritativeInformation, NoContent, ResetContent, PartialContent, MultiStatus, AlreadyReported, IMUsed, MultipleChoices, MovedPermanently, Found, SeeOther, NotModified, UseProxy, SwitchProxy, TemporaryRedirect, PermanentRedirect, BadRequest, Unauthorized, PaymentRequired, Forbidden, NotFound, MethodNotAllowed, NotAcceptable, ProxyAuthenticationRequired, RequestTimeout, Conflict, Gone, LengthRequired, PreconditionFailed, PayloadTooLarge, UriTooLong, UnsupportedMediaType, RangeNotSatisfiable, ExpectationFailed, ImATeapot, MisdirectedRequest, UnprocessableEntity, Locked, FailedDependency, UpgradeRequired, PreconditionRequired, TooManyRequests, RequestHeaderFieldsTooLarge, UnavailableForLegalReasons, InternalServerError, NotImplemented, BadGateway, ServiceUnavailable, GatewayTimeout, HttpVersionNotSupported, VariantAlsoNegotiates, InsufficientStorage, LoopDetected, NotExtended, NetworkAuthenticationRequired, Unknown(u16),
}
Expand description

Represents an HTTP status code

Variants§

§

Continue

100 Continue (RFC 7231)

§

SwitchingProtocols

101 Switching Protocols (RFC 7231)

§

Processing

102 Processing (RFC 2518)

§

EarlyHints

103 Early Hints (RFC 8297)

§

Ok

200 OK (RFC 7231)

§

Created

201 Created (RFC 7231)

§

Accepted

202 Accepted (RFC 7231)

§

NonAuthoritativeInformation

203 Non-Authoritative Information (RFC 7231)

§

NoContent

204 No Content (RFC 7231)

§

ResetContent

205 Reset Content (RFC 7231)

§

PartialContent

206 Partial Content (RFC 7233)

§

MultiStatus

207 Multi-Status (RFC 4918)

§

AlreadyReported

208 Already Reported (RFC 5842)

§

IMUsed

226 IM Used (RFC 3229)

§

MultipleChoices

300 Multiple Choices (RFC 7231)

§

MovedPermanently

301 Moved Permanently (RFC 7231)

§

Found

302 Found (RFC 7231)

§

SeeOther

303 See Other (RFC 7231)

§

NotModified

304 Not Modified (RFC 7232)

§

UseProxy

305 Use Proxy (RFC 7231)

§

SwitchProxy

306 Switch Proxy (RFC 7231)

§

TemporaryRedirect

307 Temporary Redirect (RFC 7231)

§

PermanentRedirect

308 Permanent Redirect (RFC 7538)

§

BadRequest

400 Bad Request (RFC 7231)

§

Unauthorized

401 Unauthorized (RFC 7235)

§

PaymentRequired

402 Payment Required (RFC 7231)

§

Forbidden

403 Forbidden (RFC 7231)

§

NotFound

404 Not Found (RFC 7231)

§

MethodNotAllowed

405 Method Not Allowed (RFC 7231)

§

NotAcceptable

406 Not Acceptable (RFC 7231)

§

ProxyAuthenticationRequired

407 Proxy Authentication Required (RFC 7235)

§

RequestTimeout

408 Request Timeout (RFC 7231)

§

Conflict

409 Conflict (RFC 7231)

§

Gone

410 Gone (RFC 7231)

§

LengthRequired

411 Length Required (RFC 7231)

§

PreconditionFailed

412 Precondition Failed (RFC 7232)

§

PayloadTooLarge

413 Payload Too Large (RFC 7231)

§

UriTooLong

414 URI Too Long (RFC 7231)

§

UnsupportedMediaType

415 Unsupported Media Type (RFC 7231)

§

RangeNotSatisfiable

416 Range Not Satisfiable (RFC 7233)

§

ExpectationFailed

417 Expectation Failed (RFC 7231)

§

ImATeapot

418 I’m a teapot (RFC 2324)

§

MisdirectedRequest

421 Misdirected Request (RFC 7540)

§

UnprocessableEntity

422 Unprocessable Entity (RFC 4918)

§

Locked

423 Locked (RFC 4918)

§

FailedDependency

424 Failed Dependency (RFC 4918)

§

UpgradeRequired

426 Upgrade Required (RFC 7231)

§

PreconditionRequired

428 Precondition Required (RFC 6585)

§

TooManyRequests

429 Too Many Requests (RFC 6585)

§

RequestHeaderFieldsTooLarge

431 Request Header Fields Too Large (RFC 6585)

§

UnavailableForLegalReasons

451 Unavailable For Legal Reasons (RFC 7725)

§

InternalServerError

500 Internal Server Error (RFC 7231)

§

NotImplemented

501 Not Implemented (RFC 7231)

§

BadGateway

502 Bad Gateway (RFC 7231)

§

ServiceUnavailable

503 Service Unavailable (RFC 7231)

§

GatewayTimeout

504 Gateway Timeout (RFC 7231)

§

HttpVersionNotSupported

505 HTTP Version Not Supported (RFC 7231)

§

VariantAlsoNegotiates

506 Variant Also Negotiates (RFC 2295)

§

InsufficientStorage

507 Insufficient Storage (RFC 4918)

§

LoopDetected

508 Loop Detected (RFC 5842)

§

NotExtended

510 Not Extended (RFC 2774)

§

NetworkAuthenticationRequired

511 Network Authentication Required (RFC 6585)

§

Unknown(u16)

Unknown status code

Implementations§

Source§

impl StatusCode

Source

pub fn as_u16(&self) -> u16

Returns the numeric status code

Source

pub fn reason_phrase(&self) -> &'static str

Returns the reason phrase of HTTP status code

Source

pub fn class(&self) -> StatusClass

Returns the status class of status code

Trait Implementations§

Source§

impl Clone for StatusCode

Source§

fn clone(&self) -> StatusCode

Returns a duplicate 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 StatusCode

Source§

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

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

impl<'de> Deserialize<'de> for StatusCode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for StatusCode

Source§

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

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

impl From<u16> for StatusCode

Source§

fn from(code: u16) -> Self

Converts to this type from the input type.
Source§

impl Hash for StatusCode

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 StatusCode

Source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl PartialEq for StatusCode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for StatusCode

Source§

fn partial_cmp(&self, other: &StatusCode) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for StatusCode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for StatusCode

Source§

impl StructuralPartialEq for StatusCode

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,