macro_rules! unicode_ext_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::unicode_ext_key;
use icu::locid::extensions::unicode::{Key, Value};
use icu::locid::Locale;
use writeable::Writeable;

const CALENDAR_KEY: Key = unicode_ext_key!("ca");

let loc: Locale = "de-u-ca-buddhist".parse().unwrap();

assert_eq!(
    loc.extensions.unicode.keywords.get(&CALENDAR_KEY),
    Some(&Value::from_bytes(b"buddhist").unwrap())
);