Name Description Size
mod.rs Unicode Extensions provide a mechanism to extend the [`LanguageIdentifier`] with additional bits of information - a combination of a [`LanguageIdentifier`] and [`Extensions`] is called [`Locale`]. There are four types of extensions: * [`Unicode Extensions`] - marked as `u`. * [`Transform Extensions`] - marked as `t`. * [`Private Use Extensions`] - marked as `x`. * [`Other Extensions`] - marked as any `a-z` except of `u`, `t` and `x`. One can think of extensions as a bag of extra information on top of basic 4 [`subtags`]. Notice: `Other` extension type is currently not supported. # Examples ``` use icu::locid::extensions::unicode::{Key, Value}; use icu::locid::Locale; let loc: Locale = "en-US-u-ca-buddhist-t-en-us-h0-hybrid-x-foo" .parse() .expect("Failed to parse."); assert_eq!(loc.id.language, "en".parse().unwrap()); assert_eq!(loc.id.script, None); assert_eq!(loc.id.region, Some("US".parse().unwrap())); assert_eq!(loc.id.variants.len(), 0); let key: Key = "ca".parse().expect("Parsing key failed."); let value: Value = "buddhist".parse().expect("Parsing value failed."); assert_eq!(loc.extensions.unicode.keywords.get(&key), Some(&value)); ``` [`LanguageIdentifier`]: super::LanguageIdentifier [`Locale`]: super::Locale [`subtags`]: super::subtags [`Other Extensions`]: other [`Private Use Extensions`]: private [`Transform Extensions`]: transform [`Unicode Extensions`]: unicode 11882
other
private
transform
unicode