pub enum Status {
Show 27 variants
OK = 200,
Created = 201,
Accepted = 202,
NoContent = 204,
MovedPermanently = 301,
Found = 302,
SeeOther = 303,
NotModified = 304,
TemporaryRedirect = 307,
PermanentRedirect = 308,
BadRequest = 400,
Unauthorized = 401,
Forbidden = 403,
NotFound = 404,
MethodNotAllowed = 405,
NotAcceptable = 406,
Conflict = 409,
Gone = 410,
PreconditionFailed = 412,
UnsupportedMediaType = 415,
UnprocessableEntity = 422,
TooManyRequests = 429,
InternalServerError = 500,
NotImplemented = 501,
BadGateway = 502,
ServiceUnavailable = 503,
GatewayTimeout = 504,
}
Expand description
HttpStatus const 这个 Status 枚举包含了常用的 HTTP 状态码,并提供了一些有用的方法:
Variants§
OK = 200
Created = 201
Accepted = 202
NoContent = 204
MovedPermanently = 301
Found = 302
SeeOther = 303
NotModified = 304
TemporaryRedirect = 307
PermanentRedirect = 308
BadRequest = 400
Forbidden = 403
NotFound = 404
MethodNotAllowed = 405
NotAcceptable = 406
Conflict = 409
Gone = 410
PreconditionFailed = 412
UnsupportedMediaType = 415
UnprocessableEntity = 422
TooManyRequests = 429
InternalServerError = 500
NotImplemented = 501
BadGateway = 502
GatewayTimeout = 504
Implementations§
Source§impl Status
impl Status
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
method to check http status for common cases.
pub fn is_redirection(&self) -> bool
pub fn is_client_error(&self) -> bool
pub fn is_server_error(&self) -> bool
pub fn to_u16(&self) -> u16
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Status
impl<'de> Deserialize<'de> for Status
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Status
impl Eq for Status
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
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