Macro icu_locid::extensions_unicode_key
source · [−]macro_rules! extensions_unicode_key {
($key:literal) => { ... };
}
Expand description
A macro allowing for compile-time construction of valid Unicode Key
subtag.
The macro will perform syntax canonicalization of the tag.
Examples
use icu::locid::extensions::unicode::{Key, Value};
use icu::locid::{extensions_unicode_key as key, extensions_unicode_value as value};
use icu::locid::Locale;
const CALENDAR_KEY: Key = key!("ca");
const CALENDAR_VALUE: Value = value!("buddhist");
let loc: Locale = "de-u-ca-buddhist".parse().unwrap();
assert_eq!(
loc.extensions.unicode.keywords.get(&CALENDAR_KEY),
Some(&CALENDAR_VALUE)
);