pub enum Code {
Show 17 variants
Ok = 0,
Cancelled = 1,
Unknown = 2,
InvalidArgument = 3,
DeadlineExceeded = 4,
NotFound = 5,
AlreadyExists = 6,
PermissionDenied = 7,
ResourceExhausted = 8,
FailedPrecondition = 9,
Aborted = 10,
OutOfRange = 11,
Unimplemented = 12,
Internal = 13,
Unavailable = 14,
DataLoss = 15,
Unauthenticated = 16,
}
Expand description
Represents a gRPC status code.
Variants§
Ok = 0
The operation completed successfully.
Cancelled = 1
The operation was cancelled.
Unknown = 2
Unknown error.
InvalidArgument = 3
Client specified an invalid argument.
DeadlineExceeded = 4
Deadline expired before operation could complete.
NotFound = 5
Some requested entity was not found.
AlreadyExists = 6
Some entity that we attempted to create already exists.
PermissionDenied = 7
The caller does not have permission to execute the specified operation.
ResourceExhausted = 8
Some resource has been exhausted.
FailedPrecondition = 9
The system is not in a state required for the operation’s execution.
Aborted = 10
The operation was aborted.
OutOfRange = 11
Operation was attempted past the valid range.
Unimplemented = 12
Operation is not implemented or not supported.
Internal = 13
Internal error.
The service is currently unavailable.
DataLoss = 15
Unrecoverable data loss or corruption.
Unauthenticated = 16
The request does not have valid authentication credentials
Implementations§
Source§impl Code
impl Code
Sourcepub fn from_http(http_code: StatusCode) -> Code
pub fn from_http(http_code: StatusCode) -> Code
Returns the gRPC equivalent of http::StatusCode
.
Loosely based on https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md with the following changes:
- http::StatusCode::NOT_FOUND => Code::NotFound (instead of Code::Unimplemented)
- http::StatusCode::UNPROCESSABLE_ENTITY => Code::InvalidArgument (instead of Code::Unknown)
- http::StatusCode::NOT_IMPLEMENTED => Code::Unimplemented (instead of Code::Unknown)
- http::StatusCode::INTERNAL_SERVER_ERROR => Code::Internal (instead of Code::Unknown)
- http::StatusCode::OK => Code::Ok (instead of Code::Unknown)
Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Get description of this Code
.
Sourcepub fn to_header_value(self) -> HeaderValue
pub fn to_header_value(self) -> HeaderValue
Returns http::HeaderValue
representation.
Trait Implementations§
Source§impl From<StatusCode> for Code
impl From<StatusCode> for Code
Source§fn from(value: StatusCode) -> Self
fn from(value: StatusCode) -> Self
impl Copy for Code
impl Eq for Code
impl StructuralPartialEq for Code
Auto Trait Implementations§
impl Freeze for Code
impl RefUnwindSafe for Code
impl Send for Code
impl Sync for Code
impl Unpin for Code
impl UnwindSafe for Code
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,
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
key
and return true
if they are equal.