icu_locid::subtags

Macro language

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

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

§Examples

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

assert_eq!(
  icu_locid::subtags::language!("en"),
  "en".parse::<icu_locid::subtags::Language>().unwrap()
);

Invalid input is a compile failure:

icu_locid::subtags::language!("419");