pub struct HttpStatus { /* private fields */ }Expand description
An HTTP status code.
Wraps http::StatusCode to reuse its validation and convenience methods.
Implementations§
Source§impl HttpStatus
impl HttpStatus
Sourcepub const fn new(code: StatusCode) -> Self
pub const fn new(code: StatusCode) -> Self
Creates an HttpStatus from a StatusCode.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the three-digit ASCII representation of this status (e.g., "200").
Sourcepub fn is_informational(&self) -> bool
pub fn is_informational(&self) -> bool
Checks if this status is in the 1xx (informational) range.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Checks if this status is in the 2xx (success) range.
Sourcepub fn is_redirection(&self) -> bool
pub fn is_redirection(&self) -> bool
Checks if this status is in the 3xx (redirection) range.
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Checks if this status is in the 4xx (client error) range.
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Checks if this status is in the 5xx (server error) range.
Trait Implementations§
Source§impl Clone for HttpStatus
impl Clone for HttpStatus
Source§impl Debug for HttpStatus
impl Debug for HttpStatus
Source§impl TryFrom<u16> for HttpStatus
impl TryFrom<u16> for HttpStatus
Auto Trait Implementations§
impl Freeze for HttpStatus
impl RefUnwindSafe for HttpStatus
impl Send for HttpStatus
impl Sync for HttpStatus
impl Unpin for HttpStatus
impl UnsafeUnpin for HttpStatus
impl UnwindSafe for HttpStatus
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