icu_locid::subtags

Macro variant

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

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

§Examples

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

assert_eq!(
  icu_locid::subtags::variant!("posix"),
  "posix".parse::<icu_locid::subtags::Variant>().unwrap()
);

Invalid input is a compile failure:

icu_locid::subtags::variant!("yes");