/choice_nocase

proc_macro to transform a literal string as a list of choice of literal string were all case variation are present

Primary LanguageRust

Transforms a string as a list of strings separated by `|`` where all combinations of character cases are generated. By construction first one is fully uppercase, second one is fully lowercase.

The following call:

match value.as_ref() {
	choice_nocase!("hi") => println!("good"),
	_ => println!("bad")
};

corresponds to a similar macro expansion:

match value.as_ref() {
	"HI" | "hi" | "Hi" | "hI" => println!("good"),
	_ => println!("bad")
};