http1::status

Struct StatusCode

source
pub struct StatusCode(/* private fields */);

Implementations§

source§

impl StatusCode

source

pub const fn new(status: u16) -> Self

Constructs an status code.

source

pub fn try_from_status(status: u16) -> Result<Self, u16>

Constructs an status code and return an error if the value is an invalid status code.

source

pub const fn as_u16(&self) -> u16

Returns the status as u16.

source

pub fn is_redirection(&self) -> bool

Whether if this status is a redirections status code.

source

pub fn is_client_error(&self) -> bool

Whether if this status is a client error status code.

source

pub fn is_server_error(&self) -> bool

Whether if this status is a server error status code.

source

pub fn is_success(&self) -> bool

Whether if this status code is between 200-299.

source

pub fn is_error(&self) -> bool

Whether if this status code is between 400-599.

source§

impl StatusCode

source

pub const CONTINUE: StatusCode = _

source

pub const SWITCHING_PROTOCOLS: StatusCode = _

source

pub const EARLY_HINTS: StatusCode = _

source

pub const OK: StatusCode = _

source

pub const CREATED: StatusCode = _

source

pub const ACCEPTED: StatusCode = _

source

pub const NON_AUTHORITATIVE_INFORMATION: StatusCode = _

source

pub const NO_CONTENT: StatusCode = _

source

pub const RESET_CONTENT: StatusCode = _

source

pub const PARTIAL_CONTENT: StatusCode = _

source

pub const MULTIPLE_CHOICES: StatusCode = _

source

pub const MOVED_PERMANENTLY: StatusCode = _

source

pub const FOUND: StatusCode = _

source

pub const SEE_OTHER: StatusCode = _

source

pub const NOT_MODIFIED: StatusCode = _

source

pub const USE_PROXY: StatusCode = _

source

pub const UNUSED: StatusCode = _

source

pub const TEMPORARY_REDIRECT: StatusCode = _

source

pub const PERMANENT_REDIRECT: StatusCode = _

source

pub const BAD_REQUEST: StatusCode = _

source

pub const UNAUTHORIZED: StatusCode = _

source

pub const PAYMENT_REQUIRED: StatusCode = _

source

pub const FORBIDDEN: StatusCode = _

source

pub const NOT_FOUND: StatusCode = _

source

pub const METHOD_NOT_ALLOWED: StatusCode = _

source

pub const NOT_ACCEPTABLE: StatusCode = _

source

pub const PROXY_AUTHENTICATION_REQUIRED: StatusCode = _

source

pub const REQUEST_TIMEOUT: StatusCode = _

source

pub const CONFLICT: StatusCode = _

source

pub const GONE: StatusCode = _

source

pub const LENGTH_REQUIRED: StatusCode = _

source

pub const PRECONDITION_FAILED: StatusCode = _

source

pub const PAYLOAD_TOO_LARGE: StatusCode = _

source

pub const URI_TOO_LONG: StatusCode = _

source

pub const UNSUPPORTED_MEDIA_TYPE: StatusCode = _

source

pub const RANGE_NOT_SATISFIABLE: StatusCode = _

source

pub const EXPECTATION_FAILED: StatusCode = _

source

pub const IM_A_TEAPOT: StatusCode = _

source

pub const MISDIRECTED_REQUEST: StatusCode = _

source

pub const UNPROCESSABLE_CONTENT: StatusCode = _

source

pub const LOCKED: StatusCode = _

source

pub const FAILED_DEPENDENCY: StatusCode = _

source

pub const TOO_EARLY: StatusCode = _

source

pub const UPGRADE_REQUIRED: StatusCode = _

source

pub const PRECONDITION_REQUIRED: StatusCode = _

source

pub const TOO_MANY_REQUESTS: StatusCode = _

source

pub const REQUEST_HEADER_FIELDS_TOO_LARGE: StatusCode = _

source

pub const INTERNAL_SERVER_ERROR: StatusCode = _

source

pub const NOT_IMPLEMENTED: StatusCode = _

source

pub const BAD_GATEWAY: StatusCode = _

source

pub const SERVICE_UNAVAILABLE: StatusCode = _

source

pub const GATEWAY_TIMEOUT: StatusCode = _

source

pub const HTTP_VERSION_NOT_SUPPORTED: StatusCode = _

source

pub const VARIANT_ALSO_NEGOTIATES: StatusCode = _

source

pub const INSUFFICIENT_STORAGE: StatusCode = _

source

pub const LOOP_DETECTED: StatusCode = _

source

pub const NOT_EXTENDED: StatusCode = _

source

pub const NETWORK_AUTHENTICATION_REQUIRED: StatusCode = _

source

pub fn reason_phrase(&self) -> Option<&str>

Returns the reason for this status code.

Trait Implementations§

source§

impl Clone for StatusCode

source§

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

impl Debug for StatusCode

source§

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

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

impl Default for StatusCode

source§

fn default() -> Self

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

impl Display for StatusCode

source§

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

Formats the value using the given formatter. Read more
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 Copy for StatusCode

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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§

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