pub struct StatusCode(/* private fields */);
Expand description
Status code of a response.
Constants are defined for the response codes that Discord defines in their response code table.
§Comparing the status code
Status codes can easily be compared with status code integers due to
implementing PartialEq<u16>
. This is equivalent to checking against the
value returned by StatusCode::get
.
Implementations§
Source§impl StatusCode
impl StatusCode
Sourcepub const OK: StatusCode
pub const OK: StatusCode
200 (OK) The request completed successfully.
Sourcepub const CREATED: StatusCode
pub const CREATED: StatusCode
201 (CREATED) The entity was created successfully.
Sourcepub const NO_CONTENT: StatusCode
pub const NO_CONTENT: StatusCode
204 (NO CONTENT) The request completed successfully but returned no content.
Sourcepub const NOT_MODIFIED: StatusCode
pub const NOT_MODIFIED: StatusCode
304 (NOT MODIFIED) The entity was not modified (no action was taken).
Sourcepub const BAD_REQUEST: StatusCode
pub const BAD_REQUEST: StatusCode
400 (BAD REQUEST) The request was improperly formatted, or the server couldn’t understand it.
Sourcepub const UNAUTHORIZED: StatusCode
pub const UNAUTHORIZED: StatusCode
401 (UNAUTHORIZED) The Authorization header was missing or invalid.
Sourcepub const FORBIDDEN: StatusCode
pub const FORBIDDEN: StatusCode
403 (FORBIDDEN) The Authorization token you passed did not have permission to the resource.
Sourcepub const NOT_FOUND: StatusCode
pub const NOT_FOUND: StatusCode
404 (NOT FOUND) The resource at the location specified doesn’t exist.
Sourcepub const METHOD_NOT_ALLOWED: StatusCode
pub const METHOD_NOT_ALLOWED: StatusCode
405 (METHOD NOT ALLOWED) The HTTP method used is not valid for the location specified.
Sourcepub const TOO_MANY_REQUESTS: StatusCode
pub const TOO_MANY_REQUESTS: StatusCode
429 (TOO MANY REQUESTS) You are being rate limited, see Rate Limits.
Sourcepub const GATEWAY_UNAVAILABLE: StatusCode
pub const GATEWAY_UNAVAILABLE: StatusCode
502 (GATEWAY UNAVAILABLE) There was not a gateway available to process your request. Wait a bit and retry.
Sourcepub const fn is_informational(self) -> bool
pub const fn is_informational(self) -> bool
Whether the status code is informational.
This is defined as being between [100, 200)
.
Sourcepub const fn is_success(self) -> bool
pub const fn is_success(self) -> bool
Whether the status code is a success.
This is defined as being between [200, 300)
.
Sourcepub const fn is_redirection(self) -> bool
pub const fn is_redirection(self) -> bool
Whether the status code is a redirection.
This is defined as being between [300, 400)
.
Sourcepub const fn is_client_error(self) -> bool
pub const fn is_client_error(self) -> bool
Whether the status code is a client error.
This is defined as being between [400, 500)
.
Sourcepub const fn is_server_error(self) -> bool
pub const fn is_server_error(self) -> bool
Whether the status code is a server error.
This is defined as being between [500, 600)
.
Trait Implementations§
Source§impl Clone for StatusCode
impl Clone for StatusCode
Source§fn clone(&self) -> StatusCode
fn clone(&self) -> StatusCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StatusCode
impl Debug for StatusCode
Source§impl Display for StatusCode
impl Display for StatusCode
Source§impl Hash for StatusCode
impl Hash for StatusCode
Source§impl Ord for StatusCode
impl Ord for StatusCode
Source§fn cmp(&self, other: &StatusCode) -> Ordering
fn cmp(&self, other: &StatusCode) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<StatusCode> for u16
impl PartialEq<StatusCode> for u16
Source§impl PartialEq<u16> for StatusCode
impl PartialEq<u16> for StatusCode
Source§impl PartialEq for StatusCode
impl PartialEq for StatusCode
Source§impl PartialOrd for StatusCode
impl PartialOrd for StatusCode
impl Copy for StatusCode
impl Eq for StatusCode
impl StructuralPartialEq for StatusCode
Auto Trait Implementations§
impl Freeze for StatusCode
impl RefUnwindSafe for StatusCode
impl Send for StatusCode
impl Sync for StatusCode
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.