Module icu::locale::exemplar_chars
source · Expand description
This module provides APIs for getting exemplar characters for a locale.
Exemplars are characters used by a language, separated into different sets. The sets are: main, auxiliary, punctuation, numbers, and index.
The sets define, according to typical usage in the language, which characters occur in which contexts with which frequency. For more information, see the documentation in the Exemplars section in Unicode Technical Standard #35 of the LDML specification.
§Examples
use icu::locale::exemplar_chars::ExemplarCharacters;
use icu::locale::locale;
let locale = locale!("en-001").into();
let exemplars_main = ExemplarCharacters::try_new_main(&locale)
.expect("locale should be present");
assert!(exemplars_main.contains('a'));
assert!(exemplars_main.contains('z'));
assert!(exemplars_main.contains_str("a"));
assert!(!exemplars_main.contains_str("ä"));
assert!(!exemplars_main.contains_str("ng"));
Structs§
- A wrapper around
UnicodeSet
data (characters and strings) - A borrowed wrapper around code point set data, returned by
ExemplarCharacters::as_borrowed()
. More efficient to query.