Function to_snake_case
pub fn to_snake_case(value: &str) -> StringExpand description
Converts value to snake_case by inserting a single _ before every
non-initial uppercase character. Every other character — including any
pre-existing _ — passes through unchanged.
This is intentionally not a natural-language word tokenizer: it does
not treat _/-/ as separators to drop and rejoin. A model named
User_Group therefore becomes user__group (double underscore), not
user_group — that looks odd, but it is what the server’s route
registration has always produced, and every client generator must
match it exactly to avoid constructing a URL the server never
registers.