pub trait Enum: Eq + Sized + Copy + Debug + Default + Send + Sync + 'static {
    const NAME: &'static str;

    fn value(&self) -> i32;
    fn from_i32(v: i32) -> Option<Self>;
    fn values() -> &'static [Self]Notable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8];
}
Expand description

Trait implemented by all protobuf enum types.

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

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.

Required methods

Get enum i32 value.

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

Get all enum values for enum type.

Implementors