icu_locid::subtags

Macro region

Source
macro_rules! region {
    ($string:literal) => { ... };
}
Expand description

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

§Examples

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

assert_eq!(
  icu_locid::subtags::region!("FR"),
  "FR".parse::<icu_locid::subtags::Region>().unwrap()
);

Invalid input is a compile failure:

icu_locid::subtags::region!("12");