icu_properties

Module 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::locid::locale;
use icu::properties::exemplar_chars;

let locale = locale!("en-001").into();
let data = exemplar_chars::exemplars_main(&locale)
    .expect("locale should be present");
let exemplars_main = data.as_borrowed();

assert!(exemplars_main.contains_char('a'));
assert!(exemplars_main.contains_char('z'));
assert!(exemplars_main.contains("a"));
assert!(!exemplars_main.contains("ä"));
assert!(!exemplars_main.contains("ng"));

Functions§