icu_locid::subtags

Macro script

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

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

§Examples

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

assert_eq!(
  icu_locid::subtags::script!("Latn"),
  "Latn".parse::<icu_locid::subtags::Script>().unwrap()
);

Invalid input is a compile failure:

icu_locid::subtags::script!("Latin");