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
gRPC status codes used by Status
.
These variants match the gRPC status codes.
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 description(&self) -> &'static str
pub fn description(&self) -> &'static str
Get description of this Code
.
fn make_grpc_request() -> tonic::Code {
// ...
tonic::Code::Ok
}
let code = make_grpc_request();
println!("Operation completed. Human readable description: {}", code.description());
If you only need description in println
, format
, log
and other
formatting contexts, you may want to use Display
impl for Code
instead.
source§impl Code
impl Code
sourcepub fn from_i32(i: i32) -> Code
pub fn from_i32(i: i32) -> Code
Get the Code
that represents the integer, if known.
If not known, returns Code::Unknown
(surprise!).
sourcepub fn from_bytes(bytes: &[u8]) -> Code
pub fn from_bytes(bytes: &[u8]) -> Code
Convert the string representation of a Code
(as stored, for example, in the grpc-status
header in a response) into a Code
. Returns Code::Unknown
if the code string is not a
valid gRPC status code.
Trait Implementations§
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request