1 use std::fmt;
2 
3 /// Trait implemented by all protobuf enum types.
4 ///
5 /// Additionally, generated enums also implement [`EnumFull`](crate::EnumFull) trait,
6 /// which provides access to reflection.
7 pub trait Enum: Eq + Sized + Copy + fmt::Debug + Default + Send + Sync + 'static {
8     /// Enum name as specified in `.proto` file.
9     ///
10     /// There's full reflection when non-lite runtime code generation is used,
11     /// and enums implement [`EnumFull`](crate::EnumFull) trait.
12     /// This operation is for lite runtime.
13     const NAME: &'static str;
14 
15     /// Get enum `i32` value.
value(&self) -> i3216     fn value(&self) -> i32;
17 
18     /// Try to create an enum from `i32` value.
19     /// Return `None` if value is unknown.
from_i32(v: i32) -> Option<Self>20     fn from_i32(v: i32) -> Option<Self>;
21 
22     /// All enum values for enum type.
23     const VALUES: &'static [Self] = &[];
24 }
25