Enum tonic::Code[][src]

[]
pub enum Code {
    Ok,
    Cancelled,
    Unknown,
    InvalidArgument,
    DeadlineExceeded,
    NotFound,
    AlreadyExists,
    PermissionDenied,
    ResourceExhausted,
    FailedPrecondition,
    Aborted,
    OutOfRange,
    Unimplemented,
    Internal,
    Unavailable,
    DataLoss,
    Unauthenticated,
    // some variants omitted
}
[]

gRPC status codes used by Status.

These variants match the gRPC status codes.

Variants

Ok
[]

The operation completed successfully.

Cancelled
[]

The operation was cancelled.

Unknown
[]

Unknown error.

InvalidArgument
[]

Client specified an invalid argument.

DeadlineExceeded
[]

Deadline expired before operation could complete.

NotFound
[]

Some requested entity was not found.

AlreadyExists
[]

Some entity that we attempted to create already exists.

PermissionDenied
[]

The caller does not have permission to execute the specified operation.

ResourceExhausted
[]

Some resource has been exhausted.

FailedPrecondition
[]

The system is not in a state required for the operation’s execution.

Aborted
[]

The operation was aborted.

OutOfRange
[]

Operation was attempted past the valid range.

Unimplemented
[]

Operation is not implemented or not supported.

Internal
[]

Internal error.

Unavailable
[]

The service is currently unavailable.

DataLoss
[]

Unrecoverable data loss or corruption.

Unauthenticated
[]

The request does not have valid authentication credentials

Implementations

impl Code[src][]

pub fn description(&self) -> &'static str[src][]

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.

impl Code[src][]

pub fn from_i32(i: i32) -> Code[src][]

Get the Code that represents the integer, if known.

If not known, returns Code::Unknown (surprise!).

Trait Implementations

impl Clone for Code[src][+]

impl Copy for Code[src]

impl Debug for Code[src][+]

impl Display for Code[src][+]

impl Eq for Code[src]

impl From<i32> for Code[src][+]

impl PartialEq<Code> for Code[src][+]

impl StructuralEq for Code[src]

impl StructuralPartialEq for Code[src]

Auto Trait Implementations

impl RefUnwindSafe for Code

impl Send for Code

impl Sync for Code

impl Unpin for Code

impl UnwindSafe for Code

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src][+]

impl<T> From<T> for T[src][+]

impl<T> Instrument for T[src][+]

impl<T> Instrument for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T> Pointable for T[src][+]

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src][+]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src][+]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src][+]

impl<T> WithSubscriber for T[src][+]