pub fn code_to_pascal_case(value: &str) -> StringExpand description
Convert an XSD enumeration value (typically all-caps) to a PascalCase Rust
variant name.
§Rules
- If the value is already mixed-case, preserve it verbatim (the XSD author chose the casing intentionally).
- If the value is all-uppercase (optionally with digits/hyphens), convert the first character to uppercase and the rest to lowercase, splitting on hyphens if present.
§Examples
use mx20022_codegen::ir::lower::code_to_pascal_case;
assert_eq!(code_to_pascal_case("ADDR"), "Addr");
assert_eq!(code_to_pascal_case("CODU"), "Codu");
assert_eq!(code_to_pascal_case("DUPL"), "Dupl");
assert_eq!(code_to_pascal_case("HIGH"), "High");
assert_eq!(code_to_pascal_case("NORM"), "Norm");
assert_eq!(code_to_pascal_case("TEST-VALUE"), "TestValue");