pub trait ProtoEnumSchema: ProtoEnum {
// Required methods
fn proto_path() -> ProtoPath;
fn proto_schema() -> EnumSchema;
fn as_proto_name(&self) -> &'static str;
fn from_proto_name(name: &str) -> Option<Self>;
// Provided method
fn is_known_variant(int: i32) -> bool { ... }
}Expand description
Trait for enums with a protobuf representation.
It provides methods that enables the generation of the protobuf schema representation for an enum.
Implemented by the proto_enum macro.
Required Methods§
Sourcefn proto_path() -> ProtoPath
fn proto_path() -> ProtoPath
Returns the protobuf path to this enum.
Sourcefn proto_schema() -> EnumSchema
fn proto_schema() -> EnumSchema
Returns the protobuf schema representation for this enum.
Sourcefn as_proto_name(&self) -> &'static str
fn as_proto_name(&self) -> &'static str
Converts the enum variant to its corresponding name in the protobuf representation.
Sourcefn from_proto_name(name: &str) -> Option<Self>
fn from_proto_name(name: &str) -> Option<Self>
Attempts conversion from the protobuf name of a given variant.
Provided Methods§
Sourcefn is_known_variant(int: i32) -> bool
fn is_known_variant(int: i32) -> bool
Checks if the received integer is among the known variants for this enum.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.