Module icu_locid::extensions::unicode[][src]

Unicode Extensions provide information about user preferences in a given locale.

The main struct for this extension is Unicode which contains Keywords and Attributes.

Examples

use icu::locid::{LanguageIdentifier, Locale};
use icu::locid::extensions::unicode::{Unicode, Key, Value, Attribute};

let mut loc: Locale = "en-US-u-foobar-hc-h12".parse()
    .expect("Parsing failed.");

let key: Key = "hc".parse()
    .expect("Parsing key failed.");
let value: Value = "h12".parse()
    .expect("Parsing value failed.");
let attribute: Attribute = "foobar".parse()
    .expect("Parsing attribute failed.");

assert_eq!(loc.extensions.unicode.keywords.get(&key), Some(&value));
assert!(loc.extensions.unicode.attributes.contains(&attribute));

assert_eq!(&loc.extensions.unicode.to_string(), "-u-foobar-hc-h12");

Structs

Attribute

An attribute used in a set of Attributes.

Attributes

A set of Attribute elements as defined in Unicode Extension Attributes.

Key

A key used in a list of Keywords.

Keywords

A list of Key-Value pairs representing functional information about locale’s internationnalization preferences.

Unicode

Unicode Extensions provide information about user preferences in a given locale.

Value

A value used in a list of Keywords.