use crate::reflect::EnumDescriptor;
use crate::reflect::EnumValueDescriptor;
pub trait ProtobufEnum: Eq + Sized + Copy + 'static {
fn value(&self) -> i32;
fn from_i32(v: i32) -> Option<Self>;
fn values() -> &'static [Self] {
panic!();
}
fn descriptor(&self) -> &'static EnumValueDescriptor {
self.enum_descriptor().value_by_number(self.value())
}
fn enum_descriptor(&self) -> &'static EnumDescriptor {
Self::enum_descriptor_static()
}
fn enum_descriptor_static() -> &'static EnumDescriptor {
panic!();
}
}