macro_rules! ccase {
($case:ident, $e:expr) => { ... };
($from:ident -> $to:ident, $e:expr) => { ... };
}Expand description
Convert an identifier into a case.
The macro can be used as follows.
use convert_case::ccase;
assert_eq!(ccase!(snake, "myVarName"), "my_var_name");
// equivalent to
// "myVarName".to_case(Case::Snake)You can also specify a from case, or the case that determines how the input string is split into words.
use convert_case::ccase;
assert_eq!(ccase!(sentence -> snake, "Ice-cream sales"), "ice-cream_sales");
// equivalent to
// "Ice-cream sales".from_case(Case::Sentence).to_case(Case::Snake)