Skip to main content

ProtoEnumSchema

Trait ProtoEnumSchema 

Source
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§

Source

fn proto_path() -> ProtoPath

Returns the protobuf path to this enum.

Source

fn proto_schema() -> EnumSchema

Returns the protobuf schema representation for this enum.

Source

fn as_proto_name(&self) -> &'static str

Converts the enum variant to its corresponding name in the protobuf representation.

Source

fn from_proto_name(name: &str) -> Option<Self>

Attempts conversion from the protobuf name of a given variant.

Provided Methods§

Source

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.

Implementors§