[−][src]Struct http_req::response::StatusCode
Code sent by a server in response to a client's request.
Example
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(200); assert!(code.is_success())
Methods
impl StatusCode
[src]
pub const fn new(code: u16) -> StatusCode
[src]
Creates new StatusCode from u16
value.
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(200);
pub fn is_info(self) -> bool
[src]
Checks if this StatusCode
is within 100-199, which indicates that it's Informational.
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(101); assert!(code.is_info())
pub fn is_success(self) -> bool
[src]
Checks if this StatusCode
is within 200-299, which indicates that it's Successful.
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(204); assert!(code.is_success())
pub fn is_redirect(self) -> bool
[src]
Checks if this StatusCode
is within 300-399, which indicates that it's Redirection.
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(301); assert!(code.is_redirect())
pub fn is_client_err(self) -> bool
[src]
Checks if this StatusCode
is within 400-499, which indicates that it's Client Error.
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(400); assert!(code.is_client_err())
pub fn is_server_err(self) -> bool
[src]
Checks if this StatusCode
is within 500-599, which indicates that it's Server Error.
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(503); assert!(code.is_server_err())
pub fn is<F: FnOnce(u16) -> bool>(self, f: F) -> bool
[src]
Checks this StatusCode
using closure f
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(203); assert!(code.is(|i| i > 199 && i < 250))
pub fn reason(self) -> Option<&'static str>
[src]
Returns Reason-Phrase
corresponding to this StatusCode
Examples
use http_req::response::StatusCode; const code: StatusCode = StatusCode::new(200); assert_eq!(code.reason(), Some("OK"))
Trait Implementations
impl Clone for StatusCode
[src]
fn clone(&self) -> StatusCode
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for StatusCode
[src]
impl Debug for StatusCode
[src]
impl Display for StatusCode
[src]
impl From<StatusCode> for u16
[src]
fn from(code: StatusCode) -> Self
[src]
impl From<u16> for StatusCode
[src]
impl FromStr for StatusCode
[src]
type Err = ParseErr
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<StatusCode, ParseErr>
[src]
impl PartialEq<StatusCode> for StatusCode
[src]
fn eq(&self, other: &StatusCode) -> bool
[src]
fn ne(&self, other: &StatusCode) -> bool
[src]
impl StructuralPartialEq for StatusCode
[src]
Auto Trait Implementations
impl RefUnwindSafe for StatusCode
impl Send for StatusCode
impl Sync for StatusCode
impl Unpin for StatusCode
impl UnwindSafe for StatusCode
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,