HttpStatus

Enum HttpStatus 

Source
pub enum HttpStatus {
Show 63 variants Continue, SwitchingProtocols, Processing, EarlyHints, Ok, Created, Accepted, NonAuthoritativeInformation, NoContent, ResetContent, PartialContent, MultiStatus, AlreadyReported, IMUsed, MultipleChoices, MovedPermanently, Found, SeeOther, NotModified, UseProxy, 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, TooEarly, UpgradeRequired, PreconditionRequired, TooManyRequests, RequestHeaderFieldsTooLarge, UnavailableForLegalReasons, InternalServerError, NotImplemented, BadGateway, ServiceUnavailable, GatewayTimeout, HTTPVersionNotSupported, VariantAlsoNegotiates, InsufficientStorage, LoopDetected, NotExtended, NetworkAuthenticationRequired, Unknown,
}
Expand description

Standard HTTP status codes.

Includes informational, success, redirection, client and server error codes.

Variants§

§

Continue

HTTP 100 Continue

§

SwitchingProtocols

HTTP 101 Switching Protocols

§

Processing

HTTP 102 Processing (WebDAV)

§

EarlyHints

HTTP 103 Early Hints

§

Ok

HTTP 200 OK

§

Created

HTTP 201 Created

§

Accepted

HTTP 202 Accepted

§

NonAuthoritativeInformation

HTTP 203 Non-Authoritative Information

§

NoContent

HTTP 204 No Content

§

ResetContent

HTTP 205 Reset Content

§

PartialContent

HTTP 206 Partial Content

§

MultiStatus

HTTP 207 Multi-Status (WebDAV)

§

AlreadyReported

HTTP 208 Already Reported (WebDAV)

§

IMUsed

HTTP 226 IM Used

§

MultipleChoices

HTTP 300 Multiple Choices

§

MovedPermanently

HTTP 301 Moved Permanently

§

Found

HTTP 302 Found

§

SeeOther

HTTP 303 See Other

§

NotModified

HTTP 304 Not Modified

§

UseProxy

HTTP 305 Use Proxy

§

TemporaryRedirect

HTTP 307 Temporary Redirect

§

PermanentRedirect

HTTP 308 Permanent Redirect

§

BadRequest

HTTP 400 Bad Request

§

Unauthorized

HTTP 401 Unauthorized

§

PaymentRequired

HTTP 402 Payment Required

§

Forbidden

HTTP 403 Forbidden

§

NotFound

HTTP 404 Not Found

§

MethodNotAllowed

HTTP 405 Method Not Allowed

§

NotAcceptable

HTTP 406 Not Acceptable

§

ProxyAuthenticationRequired

HTTP 407 Proxy Authentication Required

§

RequestTimeout

HTTP 408 Request Timeout

§

Conflict

HTTP 409 Conflict

§

Gone

HTTP 410 Gone

§

LengthRequired

HTTP 411 Length Required

§

PreconditionFailed

HTTP 412 Precondition Failed

§

PayloadTooLarge

HTTP 413 Payload Too Large

§

URITooLong

HTTP 414 URI Too Long

§

UnsupportedMediaType

HTTP 415 Unsupported Media Type

§

RangeNotSatisfiable

HTTP 416 Range Not Satisfiable

§

ExpectationFailed

HTTP 417 Expectation Failed

§

ImATeapot

HTTP 418 I’m a teapot

§

MisdirectedRequest

HTTP 421 Misdirected Request

§

UnprocessableEntity

HTTP 422 Unprocessable Entity (WebDAV)

§

Locked

HTTP 423 Locked (WebDAV)

§

FailedDependency

HTTP 424 Failed Dependency (WebDAV)

§

TooEarly

HTTP 425 Too Early

§

UpgradeRequired

HTTP 426 Upgrade Required

§

PreconditionRequired

HTTP 428 Precondition Required

§

TooManyRequests

HTTP 429 Too Many Requests

§

RequestHeaderFieldsTooLarge

HTTP 431 Request Header Fields Too Large

§

UnavailableForLegalReasons

HTTP 451 Unavailable For Legal Reasons

§

InternalServerError

HTTP 500 Internal Server Error

§

NotImplemented

HTTP 501 Not Implemented

§

BadGateway

HTTP 502 Bad Gateway

§

ServiceUnavailable

HTTP 503 Service Unavailable

§

GatewayTimeout

HTTP 504 Gateway Timeout

§

HTTPVersionNotSupported

HTTP 505 HTTP Version Not Supported

§

VariantAlsoNegotiates

HTTP 506 Variant Also Negotiates

§

InsufficientStorage

HTTP 507 Insufficient Storage (WebDAV)

§

LoopDetected

HTTP 508 Loop Detected (WebDAV)

§

NotExtended

HTTP 510 Not Extended

§

NetworkAuthenticationRequired

HTTP 511 Network Authentication Required

§

Unknown

HTTP Unknown status code

Implementations§

Source§

impl HttpStatus

The HttpStatus enum represents the HTTP status codes.

It maps common HTTP status codes to their respective meanings. It provides methods to retrieve the corresponding numeric code as well as the associated status text. Additionally, it implements conversion from a string representation of the status code.

Source

pub fn code(&self) -> ResponseStatusCode

Gets the numeric HTTP status code.

Returns the corresponding HTTP status code number for the enum variant.

§Arguments
  • &self - The HttpStatus instance.
§Returns
  • u16 - The numeric status code.
Source

pub fn phrase(code: ResponseStatusCode) -> String

Gets the textual description for a status code.

Returns the standard HTTP status text for the given numeric code.

§Arguments
  • u16 - The numeric HTTP status code.
§Returns
  • String - The standard status text description.
Source

pub fn same(&self, code_str: &str) -> bool

Checks if status matches a string representation.

Compares case-insensitively against both numeric code and text description.

§Arguments
  • &self - The HttpStatus instance.
  • &str - The string to compare against.
§Returns
  • bool - True if the string matches either code or description.

Trait Implementations§

Source§

impl Clone for HttpStatus

Source§

fn clone(&self) -> HttpStatus

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 HttpStatus

Source§

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

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

impl Default for HttpStatus

Source§

fn default() -> HttpStatus

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

impl Display for HttpStatus

Implements the Display trait for HttpStatus, allowing it to be formatted as a string.

Source§

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

Formats the status code as text.

§Arguments
  • &mut fmt::Formatter - The formatter to write to.
§Returns
  • fmt::Result - The formatting result.
Source§

impl FromStr for HttpStatus

Implements the FromStr trait for HttpStatus, allowing conversion from a string slice.

Source§

type Err = ()

The error type returned when conversion fails.

Source§

fn from_str(code_str: &str) -> Result<Self, Self::Err>

Parses a string into an HttpStatus.

Attempts to convert the string to a numeric code and match known status codes.

§Arguments
  • &str - The string to parse.
§Returns
  • Result<HttpStatus, ()> - The parsed status or error.
Source§

impl PartialEq for HttpStatus

Source§

fn eq(&self, other: &HttpStatus) -> 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 Eq for HttpStatus

Source§

impl StructuralPartialEq for HttpStatus

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> AnySend for T
where T: Any + Send,

Source§

impl<T> AnySendClone for T
where T: Any + Send + Clone,

Source§

impl<T> AnySendSync for T
where T: Any + Send + Sync,

Source§

impl<T> AnySendSyncClone for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> AnySync for T
where T: Any + Sync,

Source§

impl<T> AnySyncClone for T
where T: Any + Sync + Clone,

Source§

impl<T> ErasedDestructor for T
where T: 'static,