Skip to main content

currency

Macro currency 

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

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

§Examples

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

assert_eq!(
  icu_locale_core::preferences::extensions::unicode::keywords::currency!("usd"),
  "usd".parse::<icu_locale_core::preferences::extensions::unicode::keywords::CurrencyType>().unwrap()
);

Invalid input is a compile failure:

icu_locale_core::preferences::extensions::unicode::keywords::currency!("dollar");