pub trait NameTransformer {
// Required methods
fn to_camelcase(&self) -> String;
fn to_underscore_lowercase(&self) -> String;
fn to_underscore_uppercase(&self) -> String;
}Expand description
Transforms names into CamelCase or underscore_parts (lower or upper case)
Required Methods§
Sourcefn to_camelcase(&self) -> String
fn to_camelcase(&self) -> String
Transforms the string or string slice into a string with the camelcase equivalent.
assert_eq!("statement".to_camelcase(), "Statement");
assert_eq!("NUM_VAL".to_camelcase(), "NumVal");
assert_eq!("expr_1".to_string().to_camelcase(), "Expr1");Sourcefn to_underscore_lowercase(&self) -> String
fn to_underscore_lowercase(&self) -> String
Transforms the camelcase string slice into a string with lowercase words separated by underscores. Note that numbers are not separated.
assert_eq!("NumVal".to_underscore_lowercase(), "num_val");
assert_eq!("Expr1".to_underscore_lowercase(), "expr1");
assert_eq!("XAndY".to_string().to_underscore_lowercase(), "x_and_y");Sourcefn to_underscore_uppercase(&self) -> String
fn to_underscore_uppercase(&self) -> String
Transforms the camelcase string or string slice into a string with uppercase words separated by underscores. Note that numbers are not separated.
assert_eq!("NumVal".to_underscore_uppercase(), "NUM_VAL");
assert_eq!("Expr1".to_underscore_uppercase(), "EXPR1");
assert_eq!("XAndY".to_string().to_underscore_uppercase(), "X_AND_Y");