pub trait ProtobufEnum: Eq + Sized + Copy + 'static {
    // Required methods
    fn value(&self) -> i32;
    fn from_i32(v: i32) -> Option<Self>;

    // Provided methods
    fn values() -> &'static [Self] { ... }
    fn descriptor(&self) -> &'static EnumValueDescriptor { ... }
    fn enum_descriptor(&self) -> &'static EnumDescriptor { ... }
    fn enum_descriptor_static() -> &'static EnumDescriptor { ... }
}
Expand description

Trait implemented by all protobuf enum types.

Required Methods§

source

fn value(&self) -> i32

Get enum i32 value.

source

fn from_i32(v: i32) -> Option<Self>

Try to create an enum from i32 value. Return None if value is unknown.

Provided Methods§

source

fn values() -> &'static [Self]

Get all enum values for enum type.

source

fn descriptor(&self) -> &'static EnumValueDescriptor

Get enum value descriptor.

source

fn enum_descriptor(&self) -> &'static EnumDescriptor

Get enum descriptor.

source

fn enum_descriptor_static() -> &'static EnumDescriptor

Get enum descriptor by type.

Implementors§