Debian Codegraph @

debian/rust-vendor/icu_decimal/src/preferences.rs

raw
1 // This file is part of ICU4X. For terms of use, please see the file
2 // called LICENSE at the top level of the ICU4X source tree
3 // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5 //! Locale preferences used by this crate
6
7 use icu_locale_core::preferences::define_preferences;
8 #[cfg(feature = "unstable")]
9 use icu_locale_core::preferences::prefs_convert;
10
11 define_preferences!(
12 /// The preferences for fixed decimal formatting.
13 [Copy]
14 DecimalFormatterPreferences,
15 {
16 /// The user's preferred numbering system.
17 ///
18 /// Corresponds to the `-u-nu` in Unicode Locale Identifier.
19 ///
20 /// To get the resolved numbering system, you can inspect the data provider.
21 /// See the [`provider`] module for an example.
22 numbering_system: NumberingSystem
23 }
24 );
25
26 /// **This is a reexport of a type in [`icu::locale`](icu_locale_core::preferences::extensions::unicode::keywords)**.
27 #[doc = "\n"] // prevent autoformatting
28 pub use icu_locale_core::preferences::extensions::unicode::keywords::NumberingSystem;
29
30 #[cfg(feature = "unstable")]
31 define_preferences!(
32 /// The preferences for compact decimal formatting.
33 ///
34 /// <div class="stab unstable">
35 /// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
36 /// including in SemVer minor releases. Do not use this type unless you are prepared for things to occasionally break.
37 ///
38 /// Graduation tracking issue: [issue #7161](https://github.com/unicode-org/icu4x/issues/7161).
39 /// </div>
40 ///
41 /// ✨ *Enabled with the `unstable` Cargo feature.*
42 [Copy]
43 CompactDecimalFormatterPreferences,
44 {
45 /// The user's preferred numbering system.
46 ///
47 /// Corresponds to the `-u-nu` in Unicode Locale Identifier.
48 numbering_system: NumberingSystem
49 }
50 );
51
52 #[cfg(feature = "unstable")]
53 prefs_convert!(
54 CompactDecimalFormatterPreferences,
55 DecimalFormatterPreferences,
56 { numbering_system }
57 );
58 #[cfg(feature = "unstable")]
59 prefs_convert!(
60 CompactDecimalFormatterPreferences,
61 icu_plurals::PluralRulesPreferences
62 );