Macro icu_locid::extensions::transform::key

source ·
macro_rules! key {
    ($string:literal) => { ... };
}
Expand description

A macro allowing for compile-time construction of valid Key subtags.

§Examples

Parsing errors don’t have to be handled at runtime:

assert_eq!(
  icu_locid::extensions::transform::key!("k0"),
  "k0".parse::<icu_locid::extensions::transform::Key>().unwrap()
);

Invalid input is a compile failure:

icu_locid::extensions::transform::key!("");