Skip to main content

csharp_type_name

Function csharp_type_name 

Source
pub fn csharp_type_name(name: &str) -> String
Expand description

Apply C# initialism handling to a name that is already in PascalCase (e.g. an IR type name).

IR type names come directly from Rust PascalCase (e.g. GraphQLRouteConfig, HttpStatus). When such names have been processed by heck::ToPascalCase they may lose initialism capitalisation for the names we explicitly preserve (e.g. GraphQLRouteConfigGraphQlRouteConfig). This function restores them.

Examples:

  • GraphQlRouteConfigGraphQLRouteConfig
  • GraphQLRouteConfigGraphQLRouteConfig (idempotent)
  • HttpStatusHttpStatus (left alone — Http not in CSHARP_INITIALISMS)