Macro place_macro::to_case

source ·
to_case!() { /* proc-macro */ }
Expand description

Converts the given identifier to the given case. Second argument is the identifier and the first is string literal representing the target case. The target case can be one of:

  • "TOCASE"
  • "tocase"
  • "toCase"
  • "ToCase"
  • "to_case"
  • "TO_CASE"

Examples

use place_macro::to_case;

let my_var = 5;
let MyVar = 10;
let n = to_case!("ToCase", my_var);
assert_eq!(n, MyVar);