Skip to main content

to_shouty_snake_case

Function to_shouty_snake_case 

Source
pub fn to_shouty_snake_case(s: &str) -> String
Expand description

Convert a type name to SHOUTY_SNAKE_CASE.

Used to reconstruct the conventional enum-value prefix from an enum’s proto name so it can be stripped: RuleLevelRULE_LEVEL (then values like RULE_LEVEL_HIGH lose the RULE_LEVEL_ prefix). An underscore is inserted at each lower→upper boundary and at acronym→word boundaries (HTTPServerHTTP_SERVER); existing underscores are preserved without doubling.