pub fn to_upper_camel_case(s: &str) -> StringExpand description
Convert a protobuf enum value name to UpperCamelCase.
Word boundaries are underscores and case transitions, so the conversion
works on the canonical SHOUTY_SNAKE_CASE (RULE_LEVEL_HIGH → RuleLevelHigh)
as well as non-canonical mixed-case inputs: a lower→upper transition starts a
word (myValue → MyValue) and an acronym ends a word at the upper→lower
transition (HTTPServer → HttpServer). Each word’s first character is
upper-cased and the rest lower-cased.
The conversion is intentionally lossy: FOO_BAR and FOO__BAR both collapse
to FooBar, and HTTPServer and HTTP_SERVER both produce HttpServer. The
caller is responsible for detecting the resulting collisions.
A leading digit in the output is only reachable when the caller has stripped
a prefix first (e.g. VERSION_2 → 2); it is preserved verbatim, so callers
that need a valid Rust identifier must check for it themselves.