HttpCodes

Enum HttpCodes 

Source
#[non_exhaustive]
pub enum HttpCodes {
Show 64 variants Info_100_Continue, Info_101_SwitchingProtocols, Info_102_Processing, Info_103_EarlyHints, Success_200_Ok, Success_201_Created, Success_202_Accepted, Success_203_NotAuthoritative, Success_204_NoContent, Success_205_ResetContent, Success_206_PartialContent, Success_207_MultiStatus, Success_208_AlreadyReported, Success_226_IMUsed, Redirect_300_MultipleChoices, Redirect_301_MovedPermanently, Redirect_302_Found, Redirect_303_SeeOther, Redirect_304_NotModified, Redirect_305_UseProxy, Redirect_306_Unused, Redirect_307_Temporary, Redirect_308_PermanentRedirect, ClientError_400_BadRequest, ClientError_401_Unauthorized, ClientError_402_PaymentRequired, ClientError_403_Forbidden, ClientError_404_NotFound, ClientError_405_MethodNotAllowed, ClientError_406_NotAcceptable, ClientError_407_ProxyAuthenticationRequired, ClientError_408_RequestTimeout, ClientError_409_Conflict, ClientError_410_Gone, ClientError_411_LengthRequired, ClientError_412_PreconditionFailed, ClientError_413_PayloadTooLarge, ClientError_414_URITooLong, ClientError_415_UnsupportedMediaType, ClientError_416_RangeNotSatisfiable, ClientError_417_ExpectationFailed, ClientError_418_ImATeapot, ClientError_421_MisdirectedRequest, ClientError_422_UnprocessableContent, ClientError_423_Locked, ClientError_424_FailedDependency, ClientError_425_TooEarly, ClientError_426_UpgradeRequired, ClientError_428_PreconditionRequired, ClientError_429_TooManyRequests, ClientError_431_RequestHeaderFieldsTooLarge, ClientError_451_UnavailableForLegalReasons, ServerError_500_InternalServerError, ServerError_501_NotImplemented, ServerError_502_BadGateway, ServerError_503_ServiceUnavailable, ServerError_504_GatewayTimeout, ServerError_505_HTTPVersionNotSupported, ServerError_506_VariantAlsoNegotiates, ServerError_507_InsufficientStorage, ServerError_508_LoopDetected, ServerError_510_NotExtended, ServerError_511_NetworkAuthenticationRequired, UnknownOther(u16),
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Info_100_Continue

This interim response indicates that the client should continue the request or ignore the response if the request is already finished.

§

Info_101_SwitchingProtocols

This code is sent in response to an Upgrade request header from the client and indicates the protocol the server is switching to.

§

Info_102_Processing

This code indicates that the server has received and is processing the request, but no response is available yet.

§

Info_103_EarlyHints

This status code is primarily intended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response or preconnect to an origin from which the page will need resources.

§

Success_200_Ok

The request succeeded

§

Success_201_Created

The request succeeded, and a new resource was created as a result.

§

Success_202_Accepted

The request has been received but not yet acted upon

§

Success_203_NotAuthoritative

This response code means the returned metadata is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy.

§

Success_204_NoContent

There is no content to send for this request, but the headers may be useful

§

Success_205_ResetContent

Tells the user agent to reset the document which sent this request.

§

Success_206_PartialContent

This response code is used when the Range header is sent from the client to request only part of a resource.

§

Success_207_MultiStatus

Conveys information about multiple resources, for situations where multiple status codes might be appropriate.

§

Success_208_AlreadyReported

Used inside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of multiple bindings to the same collection.

§

Success_226_IMUsed

The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.

§

Redirect_300_MultipleChoices

The request has more than one possible response

§

Redirect_301_MovedPermanently

The URL of the requested resource has been changed permanently

§

Redirect_302_Found

This response code means that the URI of requested resource has been changed temporarily

§

Redirect_303_SeeOther

The server sent this response to direct the client to get the requested resource at another URI with a GET request.

§

Redirect_304_NotModified

This is used for caching purposes. It tells the client that the response has not been modified

§

Redirect_305_UseProxy

Defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy

§

Redirect_306_Unused

This response code is no longer used; it is just reserved

§

Redirect_307_Temporary

The server sends this response to direct the client to get the requested resource at another URI with the same method that was used in the prior request

§

Redirect_308_PermanentRedirect

This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header.

§

ClientError_400_BadRequest

The server cannot or will not process the request due to something that is perceived to be a client error

§

ClientError_401_Unauthorized

Although the HTTP standard specifies “unauthorized”, semantically this response means “unauthenticated”.

§

ClientError_402_PaymentRequired

This response code is reserved for future use. The initial aim for creating this code was using it for digital payment systems, however this status code is used very rarely and no standard convention exists.

§

ClientError_403_Forbidden

The client does not have access rights to the content

§

ClientError_404_NotFound

The server cannot find the requested resource

§

ClientError_405_MethodNotAllowed

The request method is known by the server but is not supported by the target resource

§

ClientError_406_NotAcceptable

This response is sent when the web server, after performing server-driven content negotiation, doesn’t find any content that conforms to the criteria given by the user agent

§

ClientError_407_ProxyAuthenticationRequired

This is similar to 401 Unauthorized but authentication is needed to be done by a proxy.

§

ClientError_408_RequestTimeout

This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection.

§

ClientError_409_Conflict

This response is sent when a request conflicts with the current state of the server.

§

ClientError_410_Gone

This response is sent when the requested content has been permanently deleted from server, with no forwarding address

§

ClientError_411_LengthRequired

Server rejected the request because the Content-Length header field is not defined and the server requires it.

§

ClientError_412_PreconditionFailed

The client has indicated preconditions in its headers which the server does not meet.

§

ClientError_413_PayloadTooLarge

Request entity is larger than limits defined by server

§

ClientError_414_URITooLong

The URI requested by the client is longer than the server is willing to interpret.

§

ClientError_415_UnsupportedMediaType

The media format of the requested data is not supported by the server, so the server is rejecting the request.

§

ClientError_416_RangeNotSatisfiable

The range specified by the Range header field in the request cannot be fulfilled

§

ClientError_417_ExpectationFailed

This response code means the expectation indicated by the Expect request header field cannot be met by the server.

§

ClientError_418_ImATeapot

The server refuses the attempt to brew coffee with a teapot.

§

ClientError_421_MisdirectedRequest

The request was directed at a server that is not able to produce a response

§

ClientError_422_UnprocessableContent

The request was well-formed but was unable to be followed due to semantic errors.

§

ClientError_423_Locked

The resource that is being accessed is locked.

§

ClientError_424_FailedDependency

The request failed due to failure of a previous request.

§

ClientError_425_TooEarly

Indicates that the server is unwilling to risk processing a request that might be replayed.

§

ClientError_426_UpgradeRequired

The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol

§

ClientError_428_PreconditionRequired

The origin server requires the request to be conditional. This response is intended to prevent the ‘lost update’ problem, where a client GETs a resource’s state, modifies it and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.

§

ClientError_429_TooManyRequests

The user has sent too many requests in a given amount of time (“rate limiting”).

§

ClientError_431_RequestHeaderFieldsTooLarge

The server is unwilling to process the request because its header fields are too large

§

ClientError_451_UnavailableForLegalReasons

The user agent requested a resource that cannot legally be provided, such as a web page censored by a government.

§

ServerError_500_InternalServerError

The server has encountered a situation it does not know how to handle

§

ServerError_501_NotImplemented

The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD

§

ServerError_502_BadGateway

This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.

§

ServerError_503_ServiceUnavailable

The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded

§

ServerError_504_GatewayTimeout

This error response is given when the server is acting as a gateway and cannot get a response in time

§

ServerError_505_HTTPVersionNotSupported

The HTTP version used in the request is not supported by the server.

§

ServerError_506_VariantAlsoNegotiates

The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process

§

ServerError_507_InsufficientStorage

The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request

§

ServerError_508_LoopDetected

The server detected an infinite loop while processing the request

§

ServerError_510_NotExtended

Further extensions to the request are required for the server to fulfill it

§

ServerError_511_NetworkAuthenticationRequired

Indicates that the client needs to authenticate to gain network access

§

UnknownOther(u16)

Unknown/other code

Implementations§

Source§

impl HttpCodes

Source

pub fn code(&self) -> u16

Returns the numeric HTTP status code

Source

pub fn code_type(&self) -> HttpCodeType

Returns the HTTP Code Classification/Type

Trait Implementations§

Source§

impl Clone for HttpCodes

Source§

fn clone(&self) -> HttpCodes

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 HttpCodes

Source§

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

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

impl FromStr for HttpCodes

Source§

type Err = ParseIntError

The associated error which can be returned from parsing.
Source§

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

Parses a string s to return a value of this type. Read more
Source§

impl Ord for HttpCodes

Source§

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

Source§

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

Source§

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

Source§

impl Eq for HttpCodes

Source§

impl StructuralPartialEq for HttpCodes

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, U> MaybeInto<U> for T
where U: MaybeFrom<T>,

Source§

fn maybe_into(self) -> Option<U>

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, 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.