Feature Request
GrpcCode does not provide the required From<T> implementations to easily be used over a tonic server that returns a tonic::Status with a tonic::Code. These logically are the same concept, but cannot be converted between these enums (and the numerical representaions) except by implementing your own matching logic.
Motivation
We are implementing a GrpcErrorsAsFailures for a tracing layer on top of a tonic server, and this returns a GrpcFailureClass::Code(NonZeroI32). It would be nice to have a simple path to convert this to a GrpcCode so we can leverage this in our tracing to get human-readable code strings.
Proposal
Similarly, if not identical, to impl From<i32> for tonic::Code.
Alternatives
The alternative is that users have to implement from_i32 or similar as methods themselves, which is potentially more error-prone than using a standard and common implementation, especially if gRPC status codes are changed in the future (such as to add new enumerated values for additional statuses).
Feature Request
GrpcCodedoes not provide the requiredFrom<T>implementations to easily be used over atonicserver that returns atonic::Statuswith atonic::Code. These logically are the same concept, but cannot be converted between these enums (and the numerical representaions) except by implementing your own matching logic.Motivation
We are implementing a
GrpcErrorsAsFailuresfor a tracing layer on top of atonicserver, and this returns aGrpcFailureClass::Code(NonZeroI32). It would be nice to have a simple path to convert this to aGrpcCodeso we can leverage this in our tracing to get human-readable code strings.Proposal
Similarly, if not identical, to
impl From<i32> for tonic::Code.Alternatives
The alternative is that users have to implement
from_i32or similar as methods themselves, which is potentially more error-prone than using a standard and common implementation, especially if gRPC status codes are changed in the future (such as to add new enumerated values for additional statuses).