Macro icu_locid::extensions::unicode::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::unicode::key!("ca"),
  "ca".parse::<icu_locid::extensions::unicode::Key>().unwrap()
);

Invalid input is a compile failure:

icu_locid::extensions::unicode::key!("a");