pub struct StatusCode { /* private fields */ }Expand description
An HTTP status code paired with its reason phrase.
Construct one of the common constants (e.g. StatusCode::OK) or build an
arbitrary code with StatusCode::new.
Implementations§
Source§impl StatusCode
impl StatusCode
Sourcepub const fn new(code: u16, reason: &'static str) -> StatusCode
pub const fn new(code: u16, reason: &'static str) -> StatusCode
Build a status from a numeric code and reason phrase.
Sourcepub const fn is_bodyless(self) -> bool
pub const fn is_bodyless(self) -> bool
Whether the status forbids a message body (1xx, 204, 304).
Source§impl StatusCode
Named constants for the status codes this crate uses. The names follow the
RFC 9110 registry; see StatusCode::reason for the phrase.
impl StatusCode
Named constants for the status codes this crate uses. The names follow the
RFC 9110 registry; see StatusCode::reason for the phrase.
pub const CONTINUE: StatusCode
pub const OK: StatusCode
pub const CREATED: StatusCode
pub const ACCEPTED: StatusCode
pub const NO_CONTENT: StatusCode
pub const PARTIAL_CONTENT: StatusCode
pub const MOVED_PERMANENTLY: StatusCode
pub const FOUND: StatusCode
pub const TEMPORARY_REDIRECT: StatusCode
pub const PERMANENT_REDIRECT: StatusCode
pub const NOT_MODIFIED: StatusCode
pub const BAD_REQUEST: StatusCode
pub const FORBIDDEN: StatusCode
pub const NOT_FOUND: StatusCode
pub const METHOD_NOT_ALLOWED: StatusCode
pub const LENGTH_REQUIRED: StatusCode
pub const PAYLOAD_TOO_LARGE: StatusCode
pub const RANGE_NOT_SATISFIABLE: StatusCode
pub const URI_TOO_LONG: StatusCode
pub const REQUEST_HEADER_FIELDS_TOO_LARGE: StatusCode
pub const INTERNAL_SERVER_ERROR: StatusCode
pub const NOT_IMPLEMENTED: StatusCode
pub const SERVICE_UNAVAILABLE: StatusCode
pub const HTTP_VERSION_NOT_SUPPORTED: StatusCode
Trait Implementations§
Source§impl Clone for StatusCode
impl Clone for StatusCode
Source§fn clone(&self) -> StatusCode
fn clone(&self) -> StatusCode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StatusCode
Source§impl Debug for StatusCode
impl Debug for StatusCode
impl Eq for StatusCode
Source§impl From<StatusCode> for StatusCode
impl From<StatusCode> for StatusCode
Source§fn from(s: StatusCode) -> Self
fn from(s: StatusCode) -> Self
Converts to this type from the input type.
Source§impl From<u16> for StatusCode
impl From<u16> for StatusCode
Source§fn from(code: u16) -> StatusCode
fn from(code: u16) -> StatusCode
Map a bare numeric code to a known reason phrase, falling back to a generic phrase for the class. The specific arms intentionally precede the class-range fallbacks.
Source§impl IntoResponse for StatusCode
A bare status with an empty body.
impl IntoResponse for StatusCode
A bare status with an empty body.
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Consume
self and produce the response to send.Source§impl PartialEq for StatusCode
impl PartialEq for StatusCode
Source§fn eq(&self, other: &StatusCode) -> bool
fn eq(&self, other: &StatusCode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StatusCode
Source§impl TryFrom<StatusCode> for StatusCode
impl TryFrom<StatusCode> for StatusCode
Source§type Error = InvalidStatusCode
type Error = InvalidStatusCode
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for StatusCode
impl RefUnwindSafe for StatusCode
impl Send for StatusCode
impl Sync for StatusCode
impl Unpin for StatusCode
impl UnsafeUnpin for StatusCode
impl UnwindSafe for StatusCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.