prost
prost copied to clipboard
Prepend underscore to numerical enum variants
After stripping of enum prefix from enum variant name, some constants may have invalid name because they start with number. e.g. Time3s = 0, -> 3s = 0, . As workaround, prepend _ to name of such constants, e.g. Time3s = 0, -> _3s = 0, .
It is also an issue where the variant name starts with underscore followed by a number. e.g.
enum MyEnumSize {
E_UNKNOWN = 0;
_123 = 1;
_456 = 2;
_789 = 3;
_7890 = 4;
}
to
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MyEnumSize {
EUnknown = 0,
123 = 1,
456 = 2,
789 = 3,
7890 = 4,
}
^ which is invalid.