Struct StatusCode

pub struct StatusCode(/* private fields */);
Expand description

Serializable HTTP status code.

Implementations§

§

impl StatusCode

pub const CONTINUE: StatusCode

pub const SWITCHING_PROTOCOLS: StatusCode

pub const PROCESSING: StatusCode

pub const OK: StatusCode

pub const CREATED: StatusCode

pub const ACCEPTED: StatusCode

pub const NON_AUTHORITATIVE_INFORMATION: StatusCode

pub const NO_CONTENT: StatusCode

pub const RESET_CONTENT: StatusCode

pub const PARTIAL_CONTENT: StatusCode

pub const MULTI_STATUS: StatusCode

pub const ALREADY_REPORTED: StatusCode

pub const IM_USED: StatusCode

pub const MULTIPLE_CHOICES: StatusCode

pub const MOVED_PERMANENTLY: StatusCode

pub const FOUND: StatusCode

pub const SEE_OTHER: StatusCode

pub const NOT_MODIFIED: StatusCode

pub const USE_PROXY: StatusCode

pub const TEMPORARY_REDIRECT: StatusCode

pub const PERMANENT_REDIRECT: StatusCode

pub const BAD_REQUEST: StatusCode

pub const UNAUTHORIZED: StatusCode

pub const PAYMENT_REQUIRED: StatusCode

pub const FORBIDDEN: StatusCode

pub const NOT_FOUND: StatusCode

pub const METHOD_NOT_ALLOWED: StatusCode

pub const NOT_ACCEPTABLE: StatusCode

pub const PROXY_AUTHENTICATION_REQUIRED: StatusCode

pub const REQUEST_TIMEOUT: StatusCode

pub const CONFLICT: StatusCode

pub const GONE: StatusCode

pub const LENGTH_REQUIRED: StatusCode

pub const PRECONDITION_FAILED: StatusCode

pub const PAYLOAD_TOO_LARGE: StatusCode

pub const URI_TOO_LONG: StatusCode

pub const UNSUPPORTED_MEDIA_TYPE: StatusCode

pub const RANGE_NOT_SATISFIABLE: StatusCode

pub const EXPECTATION_FAILED: StatusCode

pub const IM_A_TEAPOT: StatusCode

pub const MISDIRECTED_REQUEST: StatusCode

pub const UNPROCESSABLE_ENTITY: StatusCode

pub const LOCKED: StatusCode

pub const FAILED_DEPENDENCY: StatusCode

pub const UPGRADE_REQUIRED: StatusCode

pub const PRECONDITION_REQUIRED: StatusCode

pub const TOO_MANY_REQUESTS: StatusCode

pub const REQUEST_HEADER_FIELDS_TOO_LARGE: StatusCode

pub const INTERNAL_SERVER_ERROR: StatusCode

pub const NOT_IMPLEMENTED: StatusCode

pub const BAD_GATEWAY: StatusCode

pub const SERVICE_UNAVAILABLE: StatusCode

pub const GATEWAY_TIMEOUT: StatusCode

pub const HTTP_VERSION_NOT_SUPPORTED: StatusCode

pub const VARIANT_ALSO_NEGOTIATES: StatusCode

pub const INSUFFICIENT_STORAGE: StatusCode

pub const LOOP_DETECTED: StatusCode

pub const NOT_EXTENDED: StatusCode

pub const NETWORK_AUTHENTICATION_REQUIRED: StatusCode

pub fn is_informational(self) -> bool

Returns true if the status code is 1xx range.

If this returns true it indicates that the request was received, continuing process.

pub fn is_success(self) -> bool

Returns true if the status code is the 2xx range.

If this returns true it indicates that the request was successfully received, understood, and accepted.

pub fn is_redirection(self) -> bool

Returns true if the status code is the 3xx range.

If this returns true it indicates that further action needs to be taken in order to complete the request.

pub fn is_client_error(self) -> bool

Returns true if the status code is the 4xx range.

If this returns true it indicates that the request contains bad syntax or cannot be fulfilled.

pub fn is_server_error(self) -> bool

Returns true if the status code is the 5xx range.

If this returns true it indicates that the server failed to fulfill an apparently valid request.

pub fn canonical_reason(self) -> Option<&'static str>

The canonical reason for a given status code

Trait Implementations§

§

impl Clone for StatusCode

§

fn clone(&self) -> StatusCode

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
§

impl Debug for StatusCode

§

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

Formats the value using the given formatter. Read more
§

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

§

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

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

impl Display for StatusCode

§

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

Formats the value using the given formatter. Read more
§

impl From<StatusCode> for StatusCode

§

fn from(code: StatusCode) -> StatusCode

Converts to this type from the input type.
§

impl From<StatusCode> for StatusCode

§

fn from(code: StatusCode) -> StatusCode

Converts to this type from the input type.
§

impl Hash for StatusCode

§

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

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
§

impl PartialEq<StatusCode> for StatusCode

§

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

impl PartialEq<StatusCode> for StatusCode

§

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

impl PartialEq for StatusCode

§

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

impl Serialize for StatusCode

§

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

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

impl TryFrom<u16> for StatusCode

§

type Error = <StatusCode as TryFrom<u16>>::Error

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

fn try_from( code: u16, ) -> Result<StatusCode, <StatusCode as TryFrom<u16>>::Error>

Performs the conversion.
§

impl Copy for StatusCode

§

impl Eq for StatusCode

§

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

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

§

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

§

impl<T> MaybeSendSync for T