pub trait Enum: Eq + Sized + Copy + Debug + Default + Send + Sync + 'static {
    const NAME: &'static str;
    const VALUES: &'static [Self] = _;

    fn value(&self) -> i32;
    fn from_i32(v: i32) -> Option<Self>;
}
Expand description

Trait implemented by all protobuf enum types.

Additionally, generated enums also implement EnumFull trait, which provides access to reflection.

Required Associated Constants

Enum name as specified in .proto file.

There’s full reflection when non-lite runtime code generation is used, and enums implement EnumFull trait. This operation is for lite runtime.

Provided Associated Constants

All enum values for enum type.

Required Methods

Get enum i32 value.

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

Implementors