Coverage Report

Created: 2026-06-15 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/icu_properties-2.2.0/src/props.rs
Line
Count
Source
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
//! This module defines all available properties.
6
//!
7
//! Properties may be empty marker types and implement [`BinaryProperty`], or enumerations[^1]
8
//! and implement [`EnumeratedProperty`].
9
//!
10
//! [`BinaryProperty`]s are queried through a [`CodePointSetData`](crate::CodePointSetData),
11
//! while [`EnumeratedProperty`]s are queried through [`CodePointMapData`](crate::CodePointMapData).
12
//!
13
//! In addition, some [`EnumeratedProperty`]s also implement [`ParseableEnumeratedProperty`] or
14
//! [`NamedEnumeratedProperty`]. For these properties, [`PropertyParser`](crate::PropertyParser),
15
//! [`PropertyNamesLong`](crate::PropertyNamesLong), and [`PropertyNamesShort`](crate::PropertyNamesShort)
16
//! can be constructed.
17
//!
18
//! [^1]: either Rust `enum`s, or Rust `struct`s with associated constants (open enums)
19
20
pub use crate::names::{NamedEnumeratedProperty, ParseableEnumeratedProperty};
21
22
pub use crate::bidi::{BidiMirroringGlyph, BidiPairedBracketType};
23
24
/// See [`test_enumerated_property_completeness`] for usage.
25
/// Example input:
26
/// ```ignore
27
/// impl EastAsianWidth {
28
///     pub const Neutral: EastAsianWidth = EastAsianWidth(0);
29
///     pub const Ambiguous: EastAsianWidth = EastAsianWidth(1);
30
///     ...
31
/// }
32
/// ```
33
/// Produces `const ALL_VALUES = &[("Neutral", 0u16), ...];` by
34
/// explicitly casting first field of the struct to u16.
35
macro_rules! create_const_array {
36
    (
37
        $ ( #[$meta:meta] )*
38
        impl $enum_ty:ident {
39
            $( $(#[$const_meta:meta])* $v:vis const $i:ident: $t:ty = $e:expr; )*
40
        }
41
        #[test]
42
        fn $consts_test:ident();
43
    ) => {
44
        $( #[$meta] )*
45
        impl $enum_ty {
46
            $(
47
                $(#[$const_meta])*
48
                $v const $i: $t = $e;
49
            )*
50
51
            /// All possible values of this enum in the Unicode version
52
            /// from this ICU4X release.
53
            pub const ALL_VALUES: &'static [$enum_ty] = &[
54
                $($enum_ty::$i),*
55
            ];
56
        }
57
58
        #[cfg(feature = "datagen")]
59
        impl databake::Bake for $enum_ty {
60
            fn bake(&self, env: &databake::CrateEnv) -> databake::TokenStream {
61
                env.insert("icu_properties");
62
                match *self {
63
                    $(
64
                        Self::$i => databake::quote!(icu_properties::props::$enum_ty::$i),
65
                    )*
66
                    Self(v) => databake::quote!(icu_properties::props::$enum_ty::from_icu4c_value(#v)),
67
                }
68
            }
69
        }
70
71
72
        impl From<$enum_ty> for u16  {
73
            #[allow(trivial_numeric_casts)]
74
0
            fn from(other: $enum_ty) -> Self {
75
0
                other.0 as u16
76
0
            }
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::EastAsianWidth>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::LineBreak>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::Script>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::HangulSyllableType>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::SentenceBreak>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::CanonicalCombiningClass>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::GraphemeClusterBreak>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::WordBreak>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::IndicConjunctBreak>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::JoiningType>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::VerticalOrientation>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::IndicSyllabicCategory>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::JoiningGroup>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::NumericType>>::from
Unexecuted instantiation: <u16 as core::convert::From<icu_properties::props::BidiClass>>::from
77
        }
78
79
        #[test]
80
        fn $consts_test() {
81
            $(
82
                assert_eq!(
83
                    crate::names::PropertyNamesLong::<$enum_ty>::new().get($enum_ty::$i).unwrap()
84
                        // Rust identifiers use camel case
85
                        .replace('_', "")
86
                        // We use Ethiopian
87
                        .replace("Ethiopic", "Ethiopian")
88
                        // Nastaliq is missing a long name?
89
                        .replace("Aran", "Nastaliq")
90
                        // We spell these out
91
                        .replace("LVSyllable", "LeadingVowelSyllable")
92
                        .replace("LVTSyllable", "LeadingVowelTrailingSyllable"),
93
                    stringify!($i)
94
                );
95
            )*
96
        }
97
    }
98
}
99
100
pub use crate::code_point_map::EnumeratedProperty;
101
102
macro_rules! make_enumerated_property {
103
    (
104
        name: $name:literal;
105
        short_name: $short_name:literal;
106
        ident: $value_ty:path;
107
        data_marker: $data_marker:ty;
108
        singleton: $singleton:ident;
109
        $(ule_ty: $ule_ty:ty;)?
110
    ) => {
111
        impl crate::private::Sealed for $value_ty {}
112
113
        impl EnumeratedProperty for $value_ty {
114
            type DataMarker = $data_marker;
115
            #[cfg(feature = "compiled_data")]
116
            const SINGLETON: &'static crate::provider::PropertyCodePointMap<'static, Self> =
117
                crate::provider::Baked::$singleton;
118
            const NAME: &'static [u8] = $name.as_bytes();
119
            const SHORT_NAME: &'static [u8] = $short_name.as_bytes();
120
        }
121
122
        $(
123
            impl zerovec::ule::AsULE for $value_ty {
124
                type ULE = $ule_ty;
125
126
0
                fn to_unaligned(self) -> Self::ULE {
127
0
                    self.0.to_unaligned()
128
0
                }
Unexecuted instantiation: <icu_properties::props::EastAsianWidth as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::Script as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::HangulSyllableType as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::LineBreak as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::SentenceBreak as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::CanonicalCombiningClass as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::GraphemeClusterBreak as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::WordBreak as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::IndicConjunctBreak as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::JoiningGroup as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::JoiningType as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::IndicSyllabicCategory as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::VerticalOrientation as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::BidiClass as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::NumericType as zerovec::ule::AsULE>::to_unaligned
129
0
                fn from_unaligned(unaligned: Self::ULE) -> Self {
130
0
                    Self(zerovec::ule::AsULE::from_unaligned(unaligned))
131
0
                }
Unexecuted instantiation: <icu_properties::props::EastAsianWidth as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::Script as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::HangulSyllableType as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::LineBreak as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::SentenceBreak as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::CanonicalCombiningClass as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::GraphemeClusterBreak as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::WordBreak as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::IndicConjunctBreak as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::JoiningGroup as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::JoiningType as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::IndicSyllabicCategory as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::VerticalOrientation as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::BidiClass as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::NumericType as zerovec::ule::AsULE>::from_unaligned
132
            }
133
        )?
134
    };
135
}
136
137
/// Enumerated property `Bidi_Class`
138
///
139
/// These are the categories required by the Unicode Bidirectional Algorithm.
140
/// For the property values, see [Bidirectional Class Values](https://unicode.org/reports/tr44/#Bidi_Class_Values).
141
/// For more information, see [Unicode Standard Annex #9](https://unicode.org/reports/tr41/tr41-28.html#UAX9).
142
///
143
/// # Example
144
///
145
/// ```
146
/// use icu::properties::{props::BidiClass, CodePointMapData};
147
///
148
/// assert_eq!(
149
///     CodePointMapData::<BidiClass>::new().get('y'),
150
///     BidiClass::LeftToRight
151
/// ); // U+0079
152
/// assert_eq!(
153
///     CodePointMapData::<BidiClass>::new().get('ع'),
154
///     BidiClass::ArabicLetter
155
/// ); // U+0639
156
/// ```
157
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
158
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
159
#[allow(clippy::exhaustive_structs)] // newtype
160
#[repr(transparent)]
161
pub struct BidiClass(pub(crate) u8);
162
163
impl BidiClass {
164
    /// Returns an ICU4C `UBidiClass` value.
165
0
    pub const fn to_icu4c_value(self) -> u8 {
166
0
        self.0
167
0
    }
168
    /// Constructor from an ICU4C `UBidiClass` value.
169
0
    pub const fn from_icu4c_value(value: u8) -> Self {
170
0
        Self(value)
171
0
    }
172
}
173
174
create_const_array! {
175
#[allow(non_upper_case_globals)]
176
impl BidiClass {
177
    /// (`L`) any strong left-to-right character
178
    pub const LeftToRight: BidiClass = BidiClass(0);
179
    /// (`R`) any strong right-to-left (non-Arabic-type) character
180
    pub const RightToLeft: BidiClass = BidiClass(1);
181
    /// (`EN`) any ASCII digit or Eastern Arabic-Indic digit
182
    pub const EuropeanNumber: BidiClass = BidiClass(2);
183
    /// (`ES`) plus and minus signs
184
    pub const EuropeanSeparator: BidiClass = BidiClass(3);
185
    /// (`ET`) a terminator in a numeric format context, includes currency signs
186
    pub const EuropeanTerminator: BidiClass = BidiClass(4);
187
    /// (`AN`) any Arabic-Indic digit
188
    pub const ArabicNumber: BidiClass = BidiClass(5);
189
    /// (`CS`) commas, colons, and slashes
190
    pub const CommonSeparator: BidiClass = BidiClass(6);
191
    /// (`B`) various newline characters
192
    pub const ParagraphSeparator: BidiClass = BidiClass(7);
193
    /// (`S`) various segment-related control codes
194
    pub const SegmentSeparator: BidiClass = BidiClass(8);
195
    /// (`WS`) spaces
196
    pub const WhiteSpace: BidiClass = BidiClass(9);
197
    /// (`ON`) most other symbols and punctuation marks
198
    pub const OtherNeutral: BidiClass = BidiClass(10);
199
    /// (`LRE`) U+202A: the LR embedding control
200
    pub const LeftToRightEmbedding: BidiClass = BidiClass(11);
201
    /// (`LRO`) U+202D: the LR override control
202
    pub const LeftToRightOverride: BidiClass = BidiClass(12);
203
    /// (`AL`) any strong right-to-left (Arabic-type) character
204
    pub const ArabicLetter: BidiClass = BidiClass(13);
205
    /// (`RLE`) U+202B: the RL embedding control
206
    pub const RightToLeftEmbedding: BidiClass = BidiClass(14);
207
    /// (`RLO`) U+202E: the RL override control
208
    pub const RightToLeftOverride: BidiClass = BidiClass(15);
209
    /// (`PDF`) U+202C: terminates an embedding or override control
210
    pub const PopDirectionalFormat: BidiClass = BidiClass(16);
211
    /// (`NSM`) any nonspacing mark
212
    pub const NonspacingMark: BidiClass = BidiClass(17);
213
    /// (`BN`) most format characters, control codes, or noncharacters
214
    pub const BoundaryNeutral: BidiClass = BidiClass(18);
215
    /// (`FSI`) U+2068: the first strong isolate control
216
    pub const FirstStrongIsolate: BidiClass = BidiClass(19);
217
    /// (`LRI`) U+2066: the LR isolate control
218
    pub const LeftToRightIsolate: BidiClass = BidiClass(20);
219
    /// (`RLI`) U+2067: the RL isolate control
220
    pub const RightToLeftIsolate: BidiClass = BidiClass(21);
221
    /// (`PDI`) U+2069: terminates an isolate control
222
    pub const PopDirectionalIsolate: BidiClass = BidiClass(22);
223
}
224
#[test]
225
fn bidi_props_consts();
226
}
227
228
make_enumerated_property! {
229
    name: "Bidi_Class";
230
    short_name: "bc";
231
    ident: BidiClass;
232
    data_marker: crate::provider::PropertyEnumBidiClassV1;
233
    singleton: SINGLETON_PROPERTY_ENUM_BIDI_CLASS_V1;
234
    ule_ty: u8;
235
}
236
237
/// Enumerated property `Numeric_Type`.
238
///
239
/// See Section 4.6, Numeric Value in The Unicode Standard for the summary of
240
/// each property value.
241
///
242
/// # Example
243
///
244
/// ```
245
/// use icu::properties::{props::NumericType, CodePointMapData};
246
///
247
/// assert_eq!(
248
///     CodePointMapData::<NumericType>::new().get('0'),
249
///     NumericType::Decimal,
250
/// ); // U+0030
251
/// assert_eq!(
252
///     CodePointMapData::<NumericType>::new().get('½'),
253
///     NumericType::Numeric,
254
/// ); // U+00BD
255
/// ```
256
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
257
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
258
#[allow(clippy::exhaustive_structs)] // newtype
259
#[repr(transparent)]
260
pub struct NumericType(pub(crate) u8);
261
262
impl NumericType {
263
    /// Returns an ICU4C `UNumericType` value.
264
0
    pub const fn to_icu4c_value(self) -> u8 {
265
0
        self.0
266
0
    }
267
    /// Constructor from an ICU4C `UNumericType` value.
268
0
    pub const fn from_icu4c_value(value: u8) -> Self {
269
0
        Self(value)
270
0
    }
271
}
272
273
create_const_array! {
274
#[allow(non_upper_case_globals)]
275
impl NumericType {
276
    /// Characters without numeric value
277
    pub const None: NumericType = NumericType(0);
278
    /// (`De`) Characters of positional decimal systems
279
    ///
280
    /// These are coextensive with [`GeneralCategory::DecimalNumber`].
281
    pub const Decimal: NumericType = NumericType(1);
282
    /// (`Di`) Variants of positional or sequences thereof.
283
    ///
284
    /// The distinction between [`NumericType::Digit`] and [`NumericType::Numeric`]
285
    /// has not proven to be useful, so no further characters will be added to
286
    /// this type.
287
    pub const Digit: NumericType = NumericType(2);
288
    /// (`Nu`) Other characters with numeric value
289
    pub const Numeric: NumericType = NumericType(3);
290
}
291
#[test]
292
fn numeric_type_consts();
293
}
294
295
make_enumerated_property! {
296
    name: "Numeric_Type";
297
    short_name: "nt";
298
    ident: NumericType;
299
    data_marker: crate::provider::PropertyEnumNumericTypeV1;
300
    singleton: SINGLETON_PROPERTY_ENUM_NUMERIC_TYPE_V1;
301
    ule_ty: u8;
302
}
303
304
// This exists to encapsulate GeneralCategoryULE so that it can exist in the provider module rather than props
305
pub(crate) mod gc {
306
    /// Enumerated property `General_Category`.
307
    ///
308
    /// `General_Category` specifies the most general classification of a code point, usually
309
    /// determined based on the primary characteristic of the assigned character. For example, is the
310
    /// character a letter, a mark, a number, punctuation, or a symbol, and if so, of what type?
311
    ///
312
    /// `GeneralCategory` only supports specific subcategories (eg `UppercaseLetter`).
313
    /// It does not support grouped categories (eg `Letter`). For grouped categories, use [`GeneralCategoryGroup`](
314
    /// crate::props::GeneralCategoryGroup).
315
    ///
316
    /// # Example
317
    ///
318
    /// ```
319
    /// use icu::properties::{props::GeneralCategory, CodePointMapData};
320
    ///
321
    /// assert_eq!(
322
    ///     CodePointMapData::<GeneralCategory>::new().get('木'),
323
    ///     GeneralCategory::OtherLetter
324
    /// ); // U+6728
325
    /// assert_eq!(
326
    ///     CodePointMapData::<GeneralCategory>::new().get('🎃'),
327
    ///     GeneralCategory::OtherSymbol
328
    /// ); // U+1F383 JACK-O-LANTERN
329
    /// ```
330
    #[derive(Copy, Clone, PartialEq, Eq, Debug, Ord, PartialOrd, Hash)]
331
    #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
332
    #[cfg_attr(feature = "datagen", derive(databake::Bake))]
333
    #[cfg_attr(feature = "datagen", databake(path = icu_properties::props))]
334
    #[allow(clippy::exhaustive_enums)] // this type is stable
335
    #[zerovec::make_ule(GeneralCategoryULE)]
336
    #[cfg_attr(not(feature = "alloc"), zerovec::skip_derive(ZeroMapKV))]
337
    #[repr(u8)]
338
    pub enum GeneralCategory {
339
        /// (`Cn`) A reserved unassigned code point or a noncharacter
340
        Unassigned = 0,
341
342
        /// (`Lu`) An uppercase letter
343
        UppercaseLetter = 1,
344
        /// (`Ll`) A lowercase letter
345
        LowercaseLetter = 2,
346
        /// (`Lt`) A digraphic letter, with first part uppercase
347
        TitlecaseLetter = 3,
348
        /// (`Lm`) A modifier letter
349
        ModifierLetter = 4,
350
        /// (`Lo`) Other letters, including syllables and ideographs
351
        OtherLetter = 5,
352
353
        /// (`Mn`) A nonspacing combining mark (zero advance width)
354
        NonspacingMark = 6,
355
        /// (`Mc`) A spacing combining mark (positive advance width)
356
        SpacingMark = 8,
357
        /// (`Me`) An enclosing combining mark
358
        EnclosingMark = 7,
359
360
        /// (`Nd`) A decimal digit
361
        DecimalNumber = 9,
362
        /// (`Nl`) A letterlike numeric character
363
        LetterNumber = 10,
364
        /// (`No`) A numeric character of other type
365
        OtherNumber = 11,
366
367
        /// (`Zs`) A space character (of various non-zero widths)
368
        SpaceSeparator = 12,
369
        /// (`Zl`) U+2028 LINE SEPARATOR only
370
        LineSeparator = 13,
371
        /// (`Zp`) U+2029 PARAGRAPH SEPARATOR only
372
        ParagraphSeparator = 14,
373
374
        /// (`Cc`) A C0 or C1 control code
375
        Control = 15,
376
        /// (`Cf`) A format control character
377
        Format = 16,
378
        /// (`Co`) A private-use character
379
        PrivateUse = 17,
380
        /// (`Cs`) A surrogate code point
381
        Surrogate = 18,
382
383
        /// (`Pd`) A dash or hyphen punctuation mark
384
        DashPunctuation = 19,
385
        /// (`Ps`) An opening punctuation mark (of a pair)
386
        OpenPunctuation = 20,
387
        /// (`Pe`) A closing punctuation mark (of a pair)
388
        ClosePunctuation = 21,
389
        /// (`Pc`) A connecting punctuation mark, like a tie
390
        ConnectorPunctuation = 22,
391
        /// (`Pi`) An initial quotation mark
392
        InitialPunctuation = 28,
393
        /// (`Pf`) A final quotation mark
394
        FinalPunctuation = 29,
395
        /// (`Po`) A punctuation mark of other type
396
        OtherPunctuation = 23,
397
398
        /// (`Sm`) A symbol of mathematical use
399
        MathSymbol = 24,
400
        /// (`Sc`) A currency sign
401
        CurrencySymbol = 25,
402
        /// (`Sk`) A non-letterlike modifier symbol
403
        ModifierSymbol = 26,
404
        /// (`So`) A symbol of other type
405
        OtherSymbol = 27,
406
    }
407
}
408
409
pub use gc::GeneralCategory;
410
411
impl GeneralCategory {
412
    /// All possible values of this enum
413
    pub const ALL_VALUES: &'static [GeneralCategory] = &[
414
        GeneralCategory::Unassigned,
415
        GeneralCategory::UppercaseLetter,
416
        GeneralCategory::LowercaseLetter,
417
        GeneralCategory::TitlecaseLetter,
418
        GeneralCategory::ModifierLetter,
419
        GeneralCategory::OtherLetter,
420
        GeneralCategory::NonspacingMark,
421
        GeneralCategory::SpacingMark,
422
        GeneralCategory::EnclosingMark,
423
        GeneralCategory::DecimalNumber,
424
        GeneralCategory::LetterNumber,
425
        GeneralCategory::OtherNumber,
426
        GeneralCategory::SpaceSeparator,
427
        GeneralCategory::LineSeparator,
428
        GeneralCategory::ParagraphSeparator,
429
        GeneralCategory::Control,
430
        GeneralCategory::Format,
431
        GeneralCategory::PrivateUse,
432
        GeneralCategory::Surrogate,
433
        GeneralCategory::DashPunctuation,
434
        GeneralCategory::OpenPunctuation,
435
        GeneralCategory::ClosePunctuation,
436
        GeneralCategory::ConnectorPunctuation,
437
        GeneralCategory::InitialPunctuation,
438
        GeneralCategory::FinalPunctuation,
439
        GeneralCategory::OtherPunctuation,
440
        GeneralCategory::MathSymbol,
441
        GeneralCategory::CurrencySymbol,
442
        GeneralCategory::ModifierSymbol,
443
        GeneralCategory::OtherSymbol,
444
    ];
445
}
446
447
#[test]
448
fn gc_variants() {
449
    for &variant in GeneralCategory::ALL_VALUES {
450
        assert_eq!(
451
            crate::names::PropertyNamesLong::<GeneralCategory>::new()
452
                .get(variant)
453
                .unwrap()
454
                // Rust identifiers use camel case
455
                .replace('_', ""),
456
            format!("{variant:?}")
457
        );
458
    }
459
}
460
461
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)]
462
/// Error value for `impl TryFrom<u8> for GeneralCategory`.
463
#[non_exhaustive]
464
pub struct GeneralCategoryOutOfBoundsError;
465
466
impl TryFrom<u8> for GeneralCategory {
467
    type Error = GeneralCategoryOutOfBoundsError;
468
    /// Construct this [`GeneralCategory`] from an integer, returning
469
    /// an error if it is out of bounds
470
0
    fn try_from(val: u8) -> Result<Self, GeneralCategoryOutOfBoundsError> {
471
0
        GeneralCategory::new_from_u8(val).ok_or(GeneralCategoryOutOfBoundsError)
472
0
    }
473
}
474
475
make_enumerated_property! {
476
    name: "General_Category";
477
    short_name: "gc";
478
    ident: GeneralCategory;
479
    data_marker: crate::provider::PropertyEnumGeneralCategoryV1;
480
    singleton: SINGLETON_PROPERTY_ENUM_GENERAL_CATEGORY_V1;
481
}
482
483
/// Groupings of multiple `General_Category` property values.
484
///
485
/// Instances of `GeneralCategoryGroup` represent the defined multi-category
486
/// values that are useful for users in certain contexts, such as regex. In
487
/// other words, unlike [`GeneralCategory`], this supports groups of general
488
/// categories: for example, `Letter` /// is the union of `UppercaseLetter`,
489
/// `LowercaseLetter`, etc.
490
///
491
/// See <https://www.unicode.org/reports/tr44/> .
492
///
493
/// The discriminants correspond to the `U_GC_XX_MASK` constants in ICU4C.
494
/// Unlike [`GeneralCategory`], this supports groups of general categories: for example, `Letter`
495
/// is the union of `UppercaseLetter`, `LowercaseLetter`, etc.
496
///
497
/// See `UCharCategory` and `U_GET_GC_MASK` in ICU4C.
498
#[derive(Copy, Clone, PartialEq, Debug, Eq)]
499
#[allow(clippy::exhaustive_structs)] // newtype
500
#[repr(transparent)]
501
pub struct GeneralCategoryGroup(pub(crate) u32);
502
503
impl crate::private::Sealed for GeneralCategoryGroup {}
504
505
use GeneralCategory as GC;
506
use GeneralCategoryGroup as GCG;
507
508
#[allow(non_upper_case_globals)]
509
impl GeneralCategoryGroup {
510
    /// (`Lu`) An uppercase letter
511
    pub const UppercaseLetter: GeneralCategoryGroup = GCG(1 << (GC::UppercaseLetter as u32));
512
    /// (`Ll`) A lowercase letter
513
    pub const LowercaseLetter: GeneralCategoryGroup = GCG(1 << (GC::LowercaseLetter as u32));
514
    /// (`Lt`) A digraphic letter, with first part uppercase
515
    pub const TitlecaseLetter: GeneralCategoryGroup = GCG(1 << (GC::TitlecaseLetter as u32));
516
    /// (`Lm`) A modifier letter
517
    pub const ModifierLetter: GeneralCategoryGroup = GCG(1 << (GC::ModifierLetter as u32));
518
    /// (`Lo`) Other letters, including syllables and ideographs
519
    pub const OtherLetter: GeneralCategoryGroup = GCG(1 << (GC::OtherLetter as u32));
520
    /// (`LC`) The union of `UppercaseLetter`, `LowercaseLetter`, and `TitlecaseLetter`
521
    pub const CasedLetter: GeneralCategoryGroup = GCG((1 << (GC::UppercaseLetter as u32))
522
        | (1 << (GC::LowercaseLetter as u32))
523
        | (1 << (GC::TitlecaseLetter as u32)));
524
    /// (`L`) The union of all letter categories
525
    pub const Letter: GeneralCategoryGroup = GCG((1 << (GC::UppercaseLetter as u32))
526
        | (1 << (GC::LowercaseLetter as u32))
527
        | (1 << (GC::TitlecaseLetter as u32))
528
        | (1 << (GC::ModifierLetter as u32))
529
        | (1 << (GC::OtherLetter as u32)));
530
531
    /// (`Mn`) A nonspacing combining mark (zero advance width)
532
    pub const NonspacingMark: GeneralCategoryGroup = GCG(1 << (GC::NonspacingMark as u32));
533
    /// (`Mc`) A spacing combining mark (positive advance width)
534
    pub const EnclosingMark: GeneralCategoryGroup = GCG(1 << (GC::EnclosingMark as u32));
535
    /// (`Me`) An enclosing combining mark
536
    pub const SpacingMark: GeneralCategoryGroup = GCG(1 << (GC::SpacingMark as u32));
537
    /// (`M`) The union of all mark categories
538
    pub const Mark: GeneralCategoryGroup = GCG((1 << (GC::NonspacingMark as u32))
539
        | (1 << (GC::EnclosingMark as u32))
540
        | (1 << (GC::SpacingMark as u32)));
541
542
    /// (`Nd`) A decimal digit
543
    pub const DecimalNumber: GeneralCategoryGroup = GCG(1 << (GC::DecimalNumber as u32));
544
    /// (`Nl`) A letterlike numeric character
545
    pub const LetterNumber: GeneralCategoryGroup = GCG(1 << (GC::LetterNumber as u32));
546
    /// (`No`) A numeric character of other type
547
    pub const OtherNumber: GeneralCategoryGroup = GCG(1 << (GC::OtherNumber as u32));
548
    /// (`N`) The union of all number categories
549
    pub const Number: GeneralCategoryGroup = GCG((1 << (GC::DecimalNumber as u32))
550
        | (1 << (GC::LetterNumber as u32))
551
        | (1 << (GC::OtherNumber as u32)));
552
553
    /// (`Zs`) A space character (of various non-zero widths)
554
    pub const SpaceSeparator: GeneralCategoryGroup = GCG(1 << (GC::SpaceSeparator as u32));
555
    /// (`Zl`) U+2028 LINE SEPARATOR only
556
    pub const LineSeparator: GeneralCategoryGroup = GCG(1 << (GC::LineSeparator as u32));
557
    /// (`Zp`) U+2029 PARAGRAPH SEPARATOR only
558
    pub const ParagraphSeparator: GeneralCategoryGroup = GCG(1 << (GC::ParagraphSeparator as u32));
559
    /// (`Z`) The union of all separator categories
560
    pub const Separator: GeneralCategoryGroup = GCG((1 << (GC::SpaceSeparator as u32))
561
        | (1 << (GC::LineSeparator as u32))
562
        | (1 << (GC::ParagraphSeparator as u32)));
563
564
    /// (`Cc`) A C0 or C1 control code
565
    pub const Control: GeneralCategoryGroup = GCG(1 << (GC::Control as u32));
566
    /// (`Cf`) A format control character
567
    pub const Format: GeneralCategoryGroup = GCG(1 << (GC::Format as u32));
568
    /// (`Co`) A private-use character
569
    pub const PrivateUse: GeneralCategoryGroup = GCG(1 << (GC::PrivateUse as u32));
570
    /// (`Cs`) A surrogate code point
571
    pub const Surrogate: GeneralCategoryGroup = GCG(1 << (GC::Surrogate as u32));
572
    /// (`Cn`) A reserved unassigned code point or a noncharacter
573
    pub const Unassigned: GeneralCategoryGroup = GCG(1 << (GC::Unassigned as u32));
574
    /// (`C`) The union of all control code, reserved, and unassigned categories
575
    pub const Other: GeneralCategoryGroup = GCG((1 << (GC::Control as u32))
576
        | (1 << (GC::Format as u32))
577
        | (1 << (GC::PrivateUse as u32))
578
        | (1 << (GC::Surrogate as u32))
579
        | (1 << (GC::Unassigned as u32)));
580
581
    /// (`Pd`) A dash or hyphen punctuation mark
582
    pub const DashPunctuation: GeneralCategoryGroup = GCG(1 << (GC::DashPunctuation as u32));
583
    /// (`Ps`) An opening punctuation mark (of a pair)
584
    pub const OpenPunctuation: GeneralCategoryGroup = GCG(1 << (GC::OpenPunctuation as u32));
585
    /// (`Pe`) A closing punctuation mark (of a pair)
586
    pub const ClosePunctuation: GeneralCategoryGroup = GCG(1 << (GC::ClosePunctuation as u32));
587
    /// (`Pc`) A connecting punctuation mark, like a tie
588
    pub const ConnectorPunctuation: GeneralCategoryGroup =
589
        GCG(1 << (GC::ConnectorPunctuation as u32));
590
    /// (`Pi`) An initial quotation mark
591
    pub const InitialPunctuation: GeneralCategoryGroup = GCG(1 << (GC::InitialPunctuation as u32));
592
    /// (`Pf`) A final quotation mark
593
    pub const FinalPunctuation: GeneralCategoryGroup = GCG(1 << (GC::FinalPunctuation as u32));
594
    /// (`Po`) A punctuation mark of other type
595
    pub const OtherPunctuation: GeneralCategoryGroup = GCG(1 << (GC::OtherPunctuation as u32));
596
    /// (`P`) The union of all punctuation categories
597
    pub const Punctuation: GeneralCategoryGroup = GCG((1 << (GC::DashPunctuation as u32))
598
        | (1 << (GC::OpenPunctuation as u32))
599
        | (1 << (GC::ClosePunctuation as u32))
600
        | (1 << (GC::ConnectorPunctuation as u32))
601
        | (1 << (GC::OtherPunctuation as u32))
602
        | (1 << (GC::InitialPunctuation as u32))
603
        | (1 << (GC::FinalPunctuation as u32)));
604
605
    /// (`Sm`) A symbol of mathematical use
606
    pub const MathSymbol: GeneralCategoryGroup = GCG(1 << (GC::MathSymbol as u32));
607
    /// (`Sc`) A currency sign
608
    pub const CurrencySymbol: GeneralCategoryGroup = GCG(1 << (GC::CurrencySymbol as u32));
609
    /// (`Sk`) A non-letterlike modifier symbol
610
    pub const ModifierSymbol: GeneralCategoryGroup = GCG(1 << (GC::ModifierSymbol as u32));
611
    /// (`So`) A symbol of other type
612
    pub const OtherSymbol: GeneralCategoryGroup = GCG(1 << (GC::OtherSymbol as u32));
613
    /// (`S`) The union of all symbol categories
614
    pub const Symbol: GeneralCategoryGroup = GCG((1 << (GC::MathSymbol as u32))
615
        | (1 << (GC::CurrencySymbol as u32))
616
        | (1 << (GC::ModifierSymbol as u32))
617
        | (1 << (GC::OtherSymbol as u32)));
618
619
    const ALL: u32 = (1 << (GC::FinalPunctuation as u32 + 1)) - 1;
620
621
    /// Return whether the code point belongs in the provided multi-value category.
622
    ///
623
    /// ```
624
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
625
    /// use icu::properties::CodePointMapData;
626
    ///
627
    /// let gc = CodePointMapData::<GeneralCategory>::new();
628
    ///
629
    /// assert_eq!(gc.get('A'), GeneralCategory::UppercaseLetter);
630
    /// assert!(GeneralCategoryGroup::CasedLetter.contains(gc.get('A')));
631
    ///
632
    /// // U+0B1E ORIYA LETTER NYA
633
    /// assert_eq!(gc.get('ଞ'), GeneralCategory::OtherLetter);
634
    /// assert!(GeneralCategoryGroup::Letter.contains(gc.get('ଞ')));
635
    /// assert!(!GeneralCategoryGroup::CasedLetter.contains(gc.get('ଞ')));
636
    ///
637
    /// // U+0301 COMBINING ACUTE ACCENT
638
    /// assert_eq!(gc.get('\u{0301}'), GeneralCategory::NonspacingMark);
639
    /// assert!(GeneralCategoryGroup::Mark.contains(gc.get('\u{0301}')));
640
    /// assert!(!GeneralCategoryGroup::Letter.contains(gc.get('\u{0301}')));
641
    ///
642
    /// assert_eq!(gc.get('0'), GeneralCategory::DecimalNumber);
643
    /// assert!(GeneralCategoryGroup::Number.contains(gc.get('0')));
644
    /// assert!(!GeneralCategoryGroup::Mark.contains(gc.get('0')));
645
    ///
646
    /// assert_eq!(gc.get('('), GeneralCategory::OpenPunctuation);
647
    /// assert!(GeneralCategoryGroup::Punctuation.contains(gc.get('(')));
648
    /// assert!(!GeneralCategoryGroup::Number.contains(gc.get('(')));
649
    ///
650
    /// // U+2713 CHECK MARK
651
    /// assert_eq!(gc.get('✓'), GeneralCategory::OtherSymbol);
652
    /// assert!(GeneralCategoryGroup::Symbol.contains(gc.get('✓')));
653
    /// assert!(!GeneralCategoryGroup::Punctuation.contains(gc.get('✓')));
654
    ///
655
    /// assert_eq!(gc.get(' '), GeneralCategory::SpaceSeparator);
656
    /// assert!(GeneralCategoryGroup::Separator.contains(gc.get(' ')));
657
    /// assert!(!GeneralCategoryGroup::Symbol.contains(gc.get(' ')));
658
    ///
659
    /// // U+E007F CANCEL TAG
660
    /// assert_eq!(gc.get('\u{E007F}'), GeneralCategory::Format);
661
    /// assert!(GeneralCategoryGroup::Other.contains(gc.get('\u{E007F}')));
662
    /// assert!(!GeneralCategoryGroup::Separator.contains(gc.get('\u{E007F}')));
663
    /// ```
664
0
    pub const fn contains(self, val: GeneralCategory) -> bool {
665
0
        0 != (1 << (val as u32)) & self.0
666
0
    }
667
668
    /// Produce a `GeneralCategoryGroup` that is the inverse of this one
669
    ///
670
    /// # Example
671
    ///
672
    /// ```rust
673
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
674
    ///
675
    /// let letter = GeneralCategoryGroup::Letter;
676
    /// let not_letter = letter.complement();
677
    ///
678
    /// assert!(not_letter.contains(GeneralCategory::MathSymbol));
679
    /// assert!(!letter.contains(GeneralCategory::MathSymbol));
680
    /// assert!(not_letter.contains(GeneralCategory::OtherPunctuation));
681
    /// assert!(!letter.contains(GeneralCategory::OtherPunctuation));
682
    /// assert!(!not_letter.contains(GeneralCategory::UppercaseLetter));
683
    /// assert!(letter.contains(GeneralCategory::UppercaseLetter));
684
    /// ```
685
0
    pub const fn complement(self) -> Self {
686
        // Mask off things not in Self::ALL to guarantee the mask
687
        // values stay in-range
688
0
        GeneralCategoryGroup(!self.0 & Self::ALL)
689
0
    }
690
691
    /// Return the group representing all `GeneralCategory` values
692
    ///
693
    /// # Example
694
    ///
695
    /// ```rust
696
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
697
    ///
698
    /// let all = GeneralCategoryGroup::all();
699
    ///
700
    /// assert!(all.contains(GeneralCategory::MathSymbol));
701
    /// assert!(all.contains(GeneralCategory::OtherPunctuation));
702
    /// assert!(all.contains(GeneralCategory::UppercaseLetter));
703
    /// ```
704
0
    pub const fn all() -> Self {
705
0
        Self(Self::ALL)
706
0
    }
707
708
    /// Return the empty group
709
    ///
710
    /// # Example
711
    ///
712
    /// ```rust
713
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
714
    ///
715
    /// let empty = GeneralCategoryGroup::empty();
716
    ///
717
    /// assert!(!empty.contains(GeneralCategory::MathSymbol));
718
    /// assert!(!empty.contains(GeneralCategory::OtherPunctuation));
719
    /// assert!(!empty.contains(GeneralCategory::UppercaseLetter));
720
    /// ```
721
0
    pub const fn empty() -> Self {
722
0
        Self(0)
723
0
    }
724
725
    /// Take the union of two groups
726
    ///
727
    /// # Example
728
    ///
729
    /// ```rust
730
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
731
    ///
732
    /// let letter = GeneralCategoryGroup::Letter;
733
    /// let symbol = GeneralCategoryGroup::Symbol;
734
    /// let union = letter.union(symbol);
735
    ///
736
    /// assert!(union.contains(GeneralCategory::MathSymbol));
737
    /// assert!(!union.contains(GeneralCategory::OtherPunctuation));
738
    /// assert!(union.contains(GeneralCategory::UppercaseLetter));
739
    /// ```
740
0
    pub const fn union(self, other: Self) -> Self {
741
0
        Self(self.0 | other.0)
742
0
    }
743
744
    /// Take the intersection of two groups
745
    ///
746
    /// # Example
747
    ///
748
    /// ```rust
749
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
750
    ///
751
    /// let letter = GeneralCategoryGroup::Letter;
752
    /// let lu = GeneralCategoryGroup::UppercaseLetter;
753
    /// let intersection = letter.intersection(lu);
754
    ///
755
    /// assert!(!intersection.contains(GeneralCategory::MathSymbol));
756
    /// assert!(!intersection.contains(GeneralCategory::OtherPunctuation));
757
    /// assert!(intersection.contains(GeneralCategory::UppercaseLetter));
758
    /// assert!(!intersection.contains(GeneralCategory::LowercaseLetter));
759
    /// ```
760
0
    pub const fn intersection(self, other: Self) -> Self {
761
0
        Self(self.0 & other.0)
762
0
    }
763
}
764
765
impl From<GeneralCategory> for GeneralCategoryGroup {
766
0
    fn from(subcategory: GeneralCategory) -> Self {
767
0
        GeneralCategoryGroup(1 << (subcategory as u32))
768
0
    }
769
}
770
impl From<u32> for GeneralCategoryGroup {
771
0
    fn from(mask: u32) -> Self {
772
        // Mask off things not in Self::ALL to guarantee the mask
773
        // values stay in-range
774
0
        GeneralCategoryGroup(mask & Self::ALL)
775
0
    }
776
}
777
impl From<GeneralCategoryGroup> for u32 {
778
0
    fn from(group: GeneralCategoryGroup) -> Self {
779
0
        group.0
780
0
    }
781
}
782
783
/// Enumerated property Script.
784
///
785
/// This is used with both the Script and `Script_Extensions` Unicode properties.
786
/// Each character is assigned a single Script, but characters that are used in
787
/// a particular subset of scripts will be in more than one `Script_Extensions` set.
788
/// For example, `DEVANAGARI DIGIT NINE` has `Script=Devanagari`, but is also in the
789
/// `Script_Extensions` set for Dogra, Kaithi, and Mahajani. If you are trying to
790
/// determine whether a code point belongs to a certain script, you should use
791
/// [`ScriptWithExtensionsBorrowed::has_script`].
792
///
793
/// For more information, see UAX #24: <https://www.unicode.org/reports/tr24/>.
794
/// See `UScriptCode` in ICU4C.
795
///
796
/// # Example
797
///
798
/// ```
799
/// use icu::properties::{CodePointMapData, props::Script};
800
///
801
/// assert_eq!(CodePointMapData::<Script>::new().get('木'), Script::Han);  // U+6728
802
/// assert_eq!(CodePointMapData::<Script>::new().get('🎃'), Script::Common);  // U+1F383 JACK-O-LANTERN
803
/// ```
804
/// [`ScriptWithExtensionsBorrowed::has_script`]: crate::script::ScriptWithExtensionsBorrowed::has_script
805
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
806
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
807
#[allow(clippy::exhaustive_structs)] // newtype
808
#[repr(transparent)]
809
pub struct Script(pub(crate) u16);
810
811
impl Script {
812
    /// Returns an ICU4C `UScriptCode` value.
813
0
    pub const fn to_icu4c_value(self) -> u16 {
814
0
        self.0
815
0
    }
816
    /// Constructor from an ICU4C `UScriptCode` value.
817
0
    pub const fn from_icu4c_value(value: u16) -> Self {
818
0
        Self(value)
819
0
    }
820
}
821
822
create_const_array! {
823
#[allow(missing_docs)] // These constants don't need individual documentation.
824
#[allow(non_upper_case_globals)]
825
impl Script {
826
    pub const Adlam: Script = Script(167);
827
    pub const Ahom: Script = Script(161);
828
    pub const AnatolianHieroglyphs: Script = Script(156);
829
    pub const Arabic: Script = Script(2);
830
    pub const Armenian: Script = Script(3);
831
    pub const Avestan: Script = Script(117);
832
    pub const Balinese: Script = Script(62);
833
    pub const Bamum: Script = Script(130);
834
    pub const BassaVah: Script = Script(134);
835
    pub const Batak: Script = Script(63);
836
    pub const Bengali: Script = Script(4);
837
    pub const BeriaErfe: Script = Script(208);
838
    pub const Bhaiksuki: Script = Script(168);
839
    pub const Bopomofo: Script = Script(5);
840
    pub const Brahmi: Script = Script(65);
841
    pub const Braille: Script = Script(46);
842
    pub const Buginese: Script = Script(55);
843
    pub const Buhid: Script = Script(44);
844
    pub const CanadianAboriginal: Script = Script(40);
845
    pub const Carian: Script = Script(104);
846
    pub const CaucasianAlbanian: Script = Script(159);
847
    pub const Chakma: Script = Script(118);
848
    pub const Cham: Script = Script(66);
849
    pub const Cherokee: Script = Script(6);
850
    pub const Chorasmian: Script = Script(189);
851
    pub const Common: Script = Script(0);
852
    pub const Coptic: Script = Script(7);
853
    pub const Cuneiform: Script = Script(101);
854
    pub const Cypriot: Script = Script(47);
855
    pub const CyproMinoan: Script = Script(193);
856
    pub const Cyrillic: Script = Script(8);
857
    pub const Deseret: Script = Script(9);
858
    pub const Devanagari: Script = Script(10);
859
    pub const DivesAkuru: Script = Script(190);
860
    pub const Dogra: Script = Script(178);
861
    pub const Duployan: Script = Script(135);
862
    pub const EgyptianHieroglyphs: Script = Script(71);
863
    pub const Elbasan: Script = Script(136);
864
    pub const Elymaic: Script = Script(185);
865
    pub const Ethiopian: Script = Script(11);
866
    pub const Garay: Script = Script(201);
867
    pub const Georgian: Script = Script(12);
868
    pub const Glagolitic: Script = Script(56);
869
    pub const Gothic: Script = Script(13);
870
    pub const Grantha: Script = Script(137);
871
    pub const Greek: Script = Script(14);
872
    pub const Gujarati: Script = Script(15);
873
    pub const GunjalaGondi: Script = Script(179);
874
    pub const Gurmukhi: Script = Script(16);
875
    pub const GurungKhema: Script = Script(202);
876
    pub const Han: Script = Script(17);
877
    pub const Hangul: Script = Script(18);
878
    pub const HanifiRohingya: Script = Script(182);
879
    pub const Hanunoo: Script = Script(43);
880
    pub const Hatran: Script = Script(162);
881
    pub const Hebrew: Script = Script(19);
882
    pub const Hiragana: Script = Script(20);
883
    pub const ImperialAramaic: Script = Script(116);
884
    pub const Inherited: Script = Script(1);
885
    pub const InscriptionalPahlavi: Script = Script(122);
886
    pub const InscriptionalParthian: Script = Script(125);
887
    pub const Javanese: Script = Script(78);
888
    pub const Kaithi: Script = Script(120);
889
    pub const Kannada: Script = Script(21);
890
    pub const Katakana: Script = Script(22);
891
    pub const Kawi: Script = Script(198);
892
    pub const KayahLi: Script = Script(79);
893
    pub const Kharoshthi: Script = Script(57);
894
    pub const KhitanSmallScript: Script = Script(191);
895
    pub const Khmer: Script = Script(23);
896
    pub const Khojki: Script = Script(157);
897
    pub const Khudawadi: Script = Script(145);
898
    pub const KiratRai: Script = Script(203);
899
    pub const Lao: Script = Script(24);
900
    pub const Latin: Script = Script(25);
901
    pub const Lepcha: Script = Script(82);
902
    pub const Limbu: Script = Script(48);
903
    pub const LinearA: Script = Script(83);
904
    pub const LinearB: Script = Script(49);
905
    pub const Lisu: Script = Script(131);
906
    pub const Lycian: Script = Script(107);
907
    pub const Lydian: Script = Script(108);
908
    pub const Mahajani: Script = Script(160);
909
    pub const Makasar: Script = Script(180);
910
    pub const Malayalam: Script = Script(26);
911
    pub const Mandaic: Script = Script(84);
912
    pub const Manichaean: Script = Script(121);
913
    pub const Marchen: Script = Script(169);
914
    pub const MasaramGondi: Script = Script(175);
915
    pub const Medefaidrin: Script = Script(181);
916
    pub const MeeteiMayek: Script = Script(115);
917
    pub const MendeKikakui: Script = Script(140);
918
    pub const MeroiticCursive: Script = Script(141);
919
    pub const MeroiticHieroglyphs: Script = Script(86);
920
    pub const Miao: Script = Script(92);
921
    pub const Modi: Script = Script(163);
922
    pub const Mongolian: Script = Script(27);
923
    pub const Mro: Script = Script(149);
924
    pub const Multani: Script = Script(164);
925
    pub const Myanmar: Script = Script(28);
926
    pub const Nabataean: Script = Script(143);
927
    pub const NagMundari: Script = Script(199);
928
    pub const Nandinagari: Script = Script(187);
929
    pub const Nastaliq: Script = Script(200);
930
    pub const Newa: Script = Script(170);
931
    pub const NewTaiLue: Script = Script(59);
932
    pub const Nko: Script = Script(87);
933
    pub const Nushu: Script = Script(150);
934
    pub const NyiakengPuachueHmong: Script = Script(186);
935
    pub const Ogham: Script = Script(29);
936
    pub const OlChiki: Script = Script(109);
937
    pub const OldHungarian: Script = Script(76);
938
    pub const OldItalic: Script = Script(30);
939
    pub const OldNorthArabian: Script = Script(142);
940
    pub const OldPermic: Script = Script(89);
941
    pub const OldPersian: Script = Script(61);
942
    pub const OldSogdian: Script = Script(184);
943
    pub const OldSouthArabian: Script = Script(133);
944
    pub const OldTurkic: Script = Script(88);
945
    pub const OldUyghur: Script = Script(194);
946
    pub const OlOnal: Script = Script(204);
947
    pub const Oriya: Script = Script(31);
948
    pub const Osage: Script = Script(171);
949
    pub const Osmanya: Script = Script(50);
950
    pub const PahawhHmong: Script = Script(75);
951
    pub const Palmyrene: Script = Script(144);
952
    pub const PauCinHau: Script = Script(165);
953
    pub const PhagsPa: Script = Script(90);
954
    pub const Phoenician: Script = Script(91);
955
    pub const PsalterPahlavi: Script = Script(123);
956
    pub const Rejang: Script = Script(110);
957
    pub const Runic: Script = Script(32);
958
    pub const Samaritan: Script = Script(126);
959
    pub const Saurashtra: Script = Script(111);
960
    pub const Sharada: Script = Script(151);
961
    pub const Shavian: Script = Script(51);
962
    pub const Siddham: Script = Script(166);
963
    pub const Sidetic: Script = Script(209);
964
    pub const SignWriting: Script = Script(112);
965
    pub const Sinhala: Script = Script(33);
966
    pub const Sogdian: Script = Script(183);
967
    pub const SoraSompeng: Script = Script(152);
968
    pub const Soyombo: Script = Script(176);
969
    pub const Sundanese: Script = Script(113);
970
    pub const Sunuwar: Script = Script(205);
971
    pub const SylotiNagri: Script = Script(58);
972
    pub const Syriac: Script = Script(34);
973
    pub const Tagalog: Script = Script(42);
974
    pub const Tagbanwa: Script = Script(45);
975
    pub const TaiLe: Script = Script(52);
976
    pub const TaiTham: Script = Script(106);
977
    pub const TaiViet: Script = Script(127);
978
    pub const TaiYo: Script = Script(210);
979
    pub const Takri: Script = Script(153);
980
    pub const Tamil: Script = Script(35);
981
    pub const Tangsa: Script = Script(195);
982
    pub const Tangut: Script = Script(154);
983
    pub const Telugu: Script = Script(36);
984
    pub const Thaana: Script = Script(37);
985
    pub const Thai: Script = Script(38);
986
    pub const Tibetan: Script = Script(39);
987
    pub const Tifinagh: Script = Script(60);
988
    pub const Tirhuta: Script = Script(158);
989
    pub const Todhri: Script = Script(206);
990
    pub const TolongSiki: Script = Script(211);
991
    pub const Toto: Script = Script(196);
992
    pub const TuluTigalari: Script = Script(207);
993
    pub const Ugaritic: Script = Script(53);
994
    pub const Unknown: Script = Script(103);
995
    pub const Vai: Script = Script(99);
996
    pub const Vithkuqi: Script = Script(197);
997
    pub const Wancho: Script = Script(188);
998
    pub const WarangCiti: Script = Script(146);
999
    pub const Yezidi: Script = Script(192);
1000
    pub const Yi: Script = Script(41);
1001
    pub const ZanabazarSquare: Script = Script(177);
1002
}
1003
#[test]
1004
fn script_consts();
1005
}
1006
1007
impl Script {
1008
    // Doesn't actually exist!
1009
    #[doc(hidden)]
1010
    #[allow(non_upper_case_globals)]
1011
    #[deprecated]
1012
    // Some high value that ICU4C will not use anytime soon
1013
    pub const Chisoi: Script = Self(60_000);
1014
}
1015
1016
/// ✨ *Enabled with the `compiled_data` Cargo feature.*
1017
#[cfg(feature = "compiled_data")]
1018
impl From<Script> for icu_locale_core::subtags::Script {
1019
0
    fn from(value: Script) -> Self {
1020
0
        crate::PropertyNamesShort::new()
1021
0
            .get_locale_script(value)
1022
0
            .unwrap_or(icu_locale_core::subtags::script!("Zzzz"))
1023
0
    }
1024
}
1025
1026
/// ✨ *Enabled with the `compiled_data` Cargo feature.*
1027
#[cfg(feature = "compiled_data")]
1028
impl From<icu_locale_core::subtags::Script> for Script {
1029
0
    fn from(value: icu_locale_core::subtags::Script) -> Self {
1030
0
        crate::PropertyParser::new()
1031
0
            .get_strict(value.as_str())
1032
0
            .unwrap_or(Self::Unknown)
1033
0
    }
1034
}
1035
1036
make_enumerated_property! {
1037
    name: "Script";
1038
    short_name: "sc";
1039
    ident: Script;
1040
    data_marker: crate::provider::PropertyEnumScriptV1;
1041
    singleton: SINGLETON_PROPERTY_ENUM_SCRIPT_V1;
1042
    ule_ty: <u16 as zerovec::ule::AsULE>::ULE;
1043
}
1044
1045
/// Enumerated property `Hangul_Syllable_Type`
1046
///
1047
/// The Unicode standard provides both precomposed Hangul syllables and conjoining Jamo to compose
1048
/// arbitrary Hangul syllables. This property provides that ontology of Hangul code points.
1049
///
1050
/// For more information, see the [Unicode Korean FAQ](https://www.unicode.org/faq/korean.html).
1051
///
1052
/// # Example
1053
///
1054
/// ```
1055
/// use icu::properties::{props::HangulSyllableType, CodePointMapData};
1056
///
1057
/// assert_eq!(
1058
///     CodePointMapData::<HangulSyllableType>::new().get('ᄀ'),
1059
///     HangulSyllableType::LeadingJamo
1060
/// ); // U+1100
1061
/// assert_eq!(
1062
///     CodePointMapData::<HangulSyllableType>::new().get('가'),
1063
///     HangulSyllableType::LeadingVowelSyllable
1064
/// ); // U+AC00
1065
/// ```
1066
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1067
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1068
#[allow(clippy::exhaustive_structs)] // newtype
1069
#[repr(transparent)]
1070
pub struct HangulSyllableType(pub(crate) u8);
1071
1072
impl HangulSyllableType {
1073
    /// Returns an ICU4C `UHangulSyllableType` value.
1074
0
    pub const fn to_icu4c_value(self) -> u8 {
1075
0
        self.0
1076
0
    }
1077
    /// Constructor from an ICU4C `UHangulSyllableType` value.
1078
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1079
0
        Self(value)
1080
0
    }
1081
}
1082
1083
create_const_array! {
1084
#[allow(non_upper_case_globals)]
1085
impl HangulSyllableType {
1086
    /// (`NA`) not applicable (e.g. not a Hangul code point).
1087
    pub const NotApplicable: HangulSyllableType = HangulSyllableType(0);
1088
    /// (`L`) a conjoining leading consonant Jamo.
1089
    pub const LeadingJamo: HangulSyllableType = HangulSyllableType(1);
1090
    /// (`V`) a conjoining vowel Jamo.
1091
    pub const VowelJamo: HangulSyllableType = HangulSyllableType(2);
1092
    /// (`T`) a conjoining trailing consonant Jamo.
1093
    pub const TrailingJamo: HangulSyllableType = HangulSyllableType(3);
1094
    /// (`LV`) a precomposed syllable with a leading consonant and a vowel.
1095
    pub const LeadingVowelSyllable: HangulSyllableType = HangulSyllableType(4);
1096
    /// (`LVT`) a precomposed syllable with a leading consonant, a vowel, and a trailing consonant.
1097
    pub const LeadingVowelTrailingSyllable: HangulSyllableType = HangulSyllableType(5);
1098
}
1099
#[test]
1100
fn hangul_syllable_type_consts();
1101
}
1102
1103
make_enumerated_property! {
1104
    name: "Hangul_Syllable_Type";
1105
    short_name: "hst";
1106
    ident: HangulSyllableType;
1107
    data_marker: crate::provider::PropertyEnumHangulSyllableTypeV1;
1108
    singleton: SINGLETON_PROPERTY_ENUM_HANGUL_SYLLABLE_TYPE_V1;
1109
    ule_ty: u8;
1110
1111
}
1112
1113
/// Enumerated property `East_Asian_Width`.
1114
///
1115
/// See "Definition" in UAX #11 for the summary of each property value:
1116
/// <https://www.unicode.org/reports/tr11/#Definitions>
1117
///
1118
/// # Example
1119
///
1120
/// ```
1121
/// use icu::properties::{props::EastAsianWidth, CodePointMapData};
1122
///
1123
/// assert_eq!(
1124
///     CodePointMapData::<EastAsianWidth>::new().get('ア'),
1125
///     EastAsianWidth::Halfwidth
1126
/// ); // U+FF71: Halfwidth Katakana Letter A
1127
/// assert_eq!(
1128
///     CodePointMapData::<EastAsianWidth>::new().get('ア'),
1129
///     EastAsianWidth::Wide
1130
/// ); //U+30A2: Katakana Letter A
1131
/// ```
1132
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1133
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1134
#[allow(clippy::exhaustive_structs)] // newtype
1135
#[repr(transparent)]
1136
pub struct EastAsianWidth(pub(crate) u8);
1137
1138
impl EastAsianWidth {
1139
    /// Returns an ICU4C `UEastAsianWidth` value.
1140
0
    pub const fn to_icu4c_value(self) -> u8 {
1141
0
        self.0
1142
0
    }
1143
    /// Constructor from an ICU4C `UEastAsianWidth` value.
1144
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1145
0
        Self(value)
1146
0
    }
1147
}
1148
1149
create_const_array! {
1150
#[allow(missing_docs)] // These constants don't need individual documentation.
1151
#[allow(non_upper_case_globals)]
1152
impl EastAsianWidth {
1153
    pub const Neutral: EastAsianWidth = EastAsianWidth(0); //name="N"
1154
    pub const Ambiguous: EastAsianWidth = EastAsianWidth(1); //name="A"
1155
    pub const Halfwidth: EastAsianWidth = EastAsianWidth(2); //name="H"
1156
    pub const Fullwidth: EastAsianWidth = EastAsianWidth(3); //name="F"
1157
    pub const Narrow: EastAsianWidth = EastAsianWidth(4); //name="Na"
1158
    pub const Wide: EastAsianWidth = EastAsianWidth(5); //name="W"
1159
}
1160
#[test]
1161
fn east_asian_width_consts();
1162
}
1163
1164
make_enumerated_property! {
1165
    name: "East_Asian_Width";
1166
    short_name: "ea";
1167
    ident: EastAsianWidth;
1168
    data_marker: crate::provider::PropertyEnumEastAsianWidthV1;
1169
    singleton: SINGLETON_PROPERTY_ENUM_EAST_ASIAN_WIDTH_V1;
1170
    ule_ty: u8;
1171
}
1172
1173
/// Enumerated property `Line_Break`.
1174
///
1175
/// See "Line Breaking Properties" in UAX #14 for the summary of each property
1176
/// value: <https://www.unicode.org/reports/tr14/#Properties>
1177
///
1178
/// The numeric value is compatible with `ULineBreak` in ICU4C.
1179
///
1180
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
1181
///
1182
/// # Example
1183
///
1184
/// ```
1185
/// use icu::properties::{props::LineBreak, CodePointMapData};
1186
///
1187
/// assert_eq!(
1188
///     CodePointMapData::<LineBreak>::new().get(')'),
1189
///     LineBreak::CloseParenthesis
1190
/// ); // U+0029: Right Parenthesis
1191
/// assert_eq!(
1192
///     CodePointMapData::<LineBreak>::new().get('ぁ'),
1193
///     LineBreak::ConditionalJapaneseStarter
1194
/// ); //U+3041: Hiragana Letter Small A
1195
/// ```
1196
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1197
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1198
#[allow(clippy::exhaustive_structs)] // newtype
1199
#[repr(transparent)]
1200
pub struct LineBreak(pub(crate) u8);
1201
1202
impl LineBreak {
1203
    /// Returns an ICU4C `ULineBreak` value.
1204
0
    pub const fn to_icu4c_value(self) -> u8 {
1205
0
        self.0
1206
0
    }
1207
    /// Constructor from an ICU4C `ULineBreak` value.
1208
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1209
0
        Self(value)
1210
0
    }
1211
}
1212
1213
create_const_array! {
1214
#[allow(missing_docs)] // These constants don't need individual documentation.
1215
#[allow(non_upper_case_globals)]
1216
impl LineBreak {
1217
    pub const Unknown: LineBreak = LineBreak(0); // name="XX"
1218
    pub const Ambiguous: LineBreak = LineBreak(1); // name="AI"
1219
    pub const Alphabetic: LineBreak = LineBreak(2); // name="AL"
1220
    pub const BreakBoth: LineBreak = LineBreak(3); // name="B2"
1221
    pub const BreakAfter: LineBreak = LineBreak(4); // name="BA"
1222
    pub const BreakBefore: LineBreak = LineBreak(5); // name="BB"
1223
    pub const MandatoryBreak: LineBreak = LineBreak(6); // name="BK"
1224
    pub const ContingentBreak: LineBreak = LineBreak(7); // name="CB"
1225
    pub const ClosePunctuation: LineBreak = LineBreak(8); // name="CL"
1226
    pub const CombiningMark: LineBreak = LineBreak(9); // name="CM"
1227
    pub const CarriageReturn: LineBreak = LineBreak(10); // name="CR"
1228
    pub const Exclamation: LineBreak = LineBreak(11); // name="EX"
1229
    pub const Glue: LineBreak = LineBreak(12); // name="GL"
1230
    pub const Hyphen: LineBreak = LineBreak(13); // name="HY"
1231
    pub const Ideographic: LineBreak = LineBreak(14); // name="ID"
1232
    pub const Inseparable: LineBreak = LineBreak(15); // name="IN"
1233
    pub const InfixNumeric: LineBreak = LineBreak(16); // name="IS"
1234
    pub const LineFeed: LineBreak = LineBreak(17); // name="LF"
1235
    pub const Nonstarter: LineBreak = LineBreak(18); // name="NS"
1236
    pub const Numeric: LineBreak = LineBreak(19); // name="NU"
1237
    pub const OpenPunctuation: LineBreak = LineBreak(20); // name="OP"
1238
    pub const PostfixNumeric: LineBreak = LineBreak(21); // name="PO"
1239
    pub const PrefixNumeric: LineBreak = LineBreak(22); // name="PR"
1240
    pub const Quotation: LineBreak = LineBreak(23); // name="QU"
1241
    pub const ComplexContext: LineBreak = LineBreak(24); // name="SA"
1242
    pub const Surrogate: LineBreak = LineBreak(25); // name="SG"
1243
    pub const Space: LineBreak = LineBreak(26); // name="SP"
1244
    pub const BreakSymbols: LineBreak = LineBreak(27); // name="SY"
1245
    pub const ZWSpace: LineBreak = LineBreak(28); // name="ZW"
1246
    pub const NextLine: LineBreak = LineBreak(29); // name="NL"
1247
    pub const WordJoiner: LineBreak = LineBreak(30); // name="WJ"
1248
    pub const H2: LineBreak = LineBreak(31); // name="H2"
1249
    pub const H3: LineBreak = LineBreak(32); // name="H3"
1250
    pub const JL: LineBreak = LineBreak(33); // name="JL"
1251
    pub const JT: LineBreak = LineBreak(34); // name="JT"
1252
    pub const JV: LineBreak = LineBreak(35); // name="JV"
1253
    pub const CloseParenthesis: LineBreak = LineBreak(36); // name="CP"
1254
    pub const ConditionalJapaneseStarter: LineBreak = LineBreak(37); // name="CJ"
1255
    pub const HebrewLetter: LineBreak = LineBreak(38); // name="HL"
1256
    pub const RegionalIndicator: LineBreak = LineBreak(39); // name="RI"
1257
    pub const EBase: LineBreak = LineBreak(40); // name="EB"
1258
    pub const EModifier: LineBreak = LineBreak(41); // name="EM"
1259
    pub const ZWJ: LineBreak = LineBreak(42); // name="ZWJ"
1260
1261
    // Added in ICU 74:
1262
    pub const Aksara: LineBreak = LineBreak(43); // name="AK"
1263
    pub const AksaraPrebase: LineBreak = LineBreak(44); // name="AP"
1264
    pub const AksaraStart: LineBreak = LineBreak(45); // name="AS"
1265
    pub const ViramaFinal: LineBreak = LineBreak(46); // name="VF"
1266
    pub const Virama: LineBreak = LineBreak(47); // name="VI"
1267
1268
    // Added in ICU 78:
1269
    pub const UnambiguousHyphen: LineBreak = LineBreak(48); // name="HH"
1270
}
1271
#[test]
1272
fn line_break_consts();
1273
}
1274
1275
make_enumerated_property! {
1276
    name: "Line_Break";
1277
    short_name: "lb";
1278
    ident: LineBreak;
1279
    data_marker: crate::provider::PropertyEnumLineBreakV1;
1280
    singleton: SINGLETON_PROPERTY_ENUM_LINE_BREAK_V1;
1281
    ule_ty: u8;
1282
}
1283
1284
/// Enumerated property `Grapheme_Cluster_Break`.
1285
///
1286
/// See "Default Grapheme Cluster Boundary Specification" in UAX #29 for the
1287
/// summary of each property value:
1288
/// <https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table>
1289
///
1290
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
1291
///
1292
/// # Example
1293
///
1294
/// ```
1295
/// use icu::properties::{props::GraphemeClusterBreak, CodePointMapData};
1296
///
1297
/// assert_eq!(
1298
///     CodePointMapData::<GraphemeClusterBreak>::new().get('🇦'),
1299
///     GraphemeClusterBreak::RegionalIndicator
1300
/// ); // U+1F1E6: Regional Indicator Symbol Letter A
1301
/// assert_eq!(
1302
///     CodePointMapData::<GraphemeClusterBreak>::new().get('ำ'),
1303
///     GraphemeClusterBreak::SpacingMark
1304
/// ); //U+0E33: Thai Character Sara Am
1305
/// ```
1306
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1307
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1308
#[allow(clippy::exhaustive_structs)] // this type is stable
1309
#[repr(transparent)]
1310
pub struct GraphemeClusterBreak(pub(crate) u8);
1311
1312
impl GraphemeClusterBreak {
1313
    /// Returns an ICU4C `UGraphemeClusterBreak` value.
1314
0
    pub const fn to_icu4c_value(self) -> u8 {
1315
0
        self.0
1316
0
    }
1317
    /// Constructor from an ICU4C `UGraphemeClusterBreak` value.
1318
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1319
0
        Self(value)
1320
0
    }
1321
}
1322
1323
create_const_array! {
1324
#[allow(missing_docs)] // These constants don't need individual documentation.
1325
#[allow(non_upper_case_globals)]
1326
impl GraphemeClusterBreak {
1327
    pub const Other: GraphemeClusterBreak = GraphemeClusterBreak(0); // name="XX"
1328
    pub const Control: GraphemeClusterBreak = GraphemeClusterBreak(1); // name="CN"
1329
    pub const CR: GraphemeClusterBreak = GraphemeClusterBreak(2); // name="CR"
1330
    pub const Extend: GraphemeClusterBreak = GraphemeClusterBreak(3); // name="EX"
1331
    pub const L: GraphemeClusterBreak = GraphemeClusterBreak(4); // name="L"
1332
    pub const LF: GraphemeClusterBreak = GraphemeClusterBreak(5); // name="LF"
1333
    pub const LV: GraphemeClusterBreak = GraphemeClusterBreak(6); // name="LV"
1334
    pub const LVT: GraphemeClusterBreak = GraphemeClusterBreak(7); // name="LVT"
1335
    pub const T: GraphemeClusterBreak = GraphemeClusterBreak(8); // name="T"
1336
    pub const V: GraphemeClusterBreak = GraphemeClusterBreak(9); // name="V"
1337
    pub const SpacingMark: GraphemeClusterBreak = GraphemeClusterBreak(10); // name="SM"
1338
    pub const Prepend: GraphemeClusterBreak = GraphemeClusterBreak(11); // name="PP"
1339
    pub const RegionalIndicator: GraphemeClusterBreak = GraphemeClusterBreak(12); // name="RI"
1340
    /// This value is obsolete and unused.
1341
    pub const EBase: GraphemeClusterBreak = GraphemeClusterBreak(13); // name="EB"
1342
    /// This value is obsolete and unused.
1343
    pub const EBaseGAZ: GraphemeClusterBreak = GraphemeClusterBreak(14); // name="EBG"
1344
    /// This value is obsolete and unused.
1345
    pub const EModifier: GraphemeClusterBreak = GraphemeClusterBreak(15); // name="EM"
1346
    /// This value is obsolete and unused.
1347
    pub const GlueAfterZwj: GraphemeClusterBreak = GraphemeClusterBreak(16); // name="GAZ"
1348
    pub const ZWJ: GraphemeClusterBreak = GraphemeClusterBreak(17); // name="ZWJ"
1349
}
1350
#[test]
1351
fn gcb_consts();
1352
}
1353
1354
make_enumerated_property! {
1355
    name: "Grapheme_Cluster_Break";
1356
    short_name: "GCB";
1357
    ident: GraphemeClusterBreak;
1358
    data_marker: crate::provider::PropertyEnumGraphemeClusterBreakV1;
1359
    singleton: SINGLETON_PROPERTY_ENUM_GRAPHEME_CLUSTER_BREAK_V1;
1360
    ule_ty: u8;
1361
}
1362
1363
/// Enumerated property `Word_Break`.
1364
///
1365
/// See "Default Word Boundary Specification" in UAX #29 for the summary of
1366
/// each property value:
1367
/// <https://www.unicode.org/reports/tr29/#Default_Word_Boundaries>.
1368
///
1369
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
1370
///
1371
/// # Example
1372
///
1373
/// ```
1374
/// use icu::properties::{props::WordBreak, CodePointMapData};
1375
///
1376
/// assert_eq!(
1377
///     CodePointMapData::<WordBreak>::new().get('.'),
1378
///     WordBreak::MidNumLet
1379
/// ); // U+002E: Full Stop
1380
/// assert_eq!(
1381
///     CodePointMapData::<WordBreak>::new().get(','),
1382
///     WordBreak::MidNum
1383
/// ); // U+FF0C: Fullwidth Comma
1384
/// ```
1385
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1386
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1387
#[allow(clippy::exhaustive_structs)] // newtype
1388
#[repr(transparent)]
1389
pub struct WordBreak(pub(crate) u8);
1390
1391
impl WordBreak {
1392
    /// Returns an ICU4C `UWordBreak` value.
1393
0
    pub const fn to_icu4c_value(self) -> u8 {
1394
0
        self.0
1395
0
    }
1396
    /// Constructor from an ICU4C `UWordBreak` value.
1397
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1398
0
        Self(value)
1399
0
    }
1400
}
1401
1402
create_const_array! {
1403
#[allow(missing_docs)] // These constants don't need individual documentation.
1404
#[allow(non_upper_case_globals)]
1405
impl WordBreak {
1406
    pub const Other: WordBreak = WordBreak(0); // name="XX"
1407
    pub const ALetter: WordBreak = WordBreak(1); // name="LE"
1408
    pub const Format: WordBreak = WordBreak(2); // name="FO"
1409
    pub const Katakana: WordBreak = WordBreak(3); // name="KA"
1410
    pub const MidLetter: WordBreak = WordBreak(4); // name="ML"
1411
    pub const MidNum: WordBreak = WordBreak(5); // name="MN"
1412
    pub const Numeric: WordBreak = WordBreak(6); // name="NU"
1413
    pub const ExtendNumLet: WordBreak = WordBreak(7); // name="EX"
1414
    pub const CR: WordBreak = WordBreak(8); // name="CR"
1415
    pub const Extend: WordBreak = WordBreak(9); // name="Extend"
1416
    pub const LF: WordBreak = WordBreak(10); // name="LF"
1417
    pub const MidNumLet: WordBreak = WordBreak(11); // name="MB"
1418
    pub const Newline: WordBreak = WordBreak(12); // name="NL"
1419
    pub const RegionalIndicator: WordBreak = WordBreak(13); // name="RI"
1420
    pub const HebrewLetter: WordBreak = WordBreak(14); // name="HL"
1421
    pub const SingleQuote: WordBreak = WordBreak(15); // name="SQ"
1422
    pub const DoubleQuote: WordBreak = WordBreak(16); // name=DQ
1423
    /// This value is obsolete and unused.
1424
    pub const EBase: WordBreak = WordBreak(17); // name="EB"
1425
    /// This value is obsolete and unused.
1426
    pub const EBaseGAZ: WordBreak = WordBreak(18); // name="EBG"
1427
    /// This value is obsolete and unused.
1428
    pub const EModifier: WordBreak = WordBreak(19); // name="EM"
1429
    /// This value is obsolete and unused.
1430
    pub const GlueAfterZwj: WordBreak = WordBreak(20); // name="GAZ"
1431
    pub const ZWJ: WordBreak = WordBreak(21); // name="ZWJ"
1432
    pub const WSegSpace: WordBreak = WordBreak(22); // name="WSegSpace"
1433
}
1434
#[test]
1435
fn word_break_consts();
1436
}
1437
1438
make_enumerated_property! {
1439
    name: "Word_Break";
1440
    short_name: "WB";
1441
    ident: WordBreak;
1442
    data_marker: crate::provider::PropertyEnumWordBreakV1;
1443
    singleton: SINGLETON_PROPERTY_ENUM_WORD_BREAK_V1;
1444
    ule_ty: u8;
1445
}
1446
1447
/// Enumerated property `Sentence_Break`.
1448
///
1449
/// See "Default Sentence Boundary Specification" in UAX #29 for the summary of
1450
/// each property value:
1451
/// <https://www.unicode.org/reports/tr29/#Default_Word_Boundaries>.
1452
///
1453
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
1454
///
1455
/// # Example
1456
///
1457
/// ```
1458
/// use icu::properties::{props::SentenceBreak, CodePointMapData};
1459
///
1460
/// assert_eq!(
1461
///     CodePointMapData::<SentenceBreak>::new().get('9'),
1462
///     SentenceBreak::Numeric
1463
/// ); // U+FF19: Fullwidth Digit Nine
1464
/// assert_eq!(
1465
///     CodePointMapData::<SentenceBreak>::new().get(','),
1466
///     SentenceBreak::SContinue
1467
/// ); // U+002C: Comma
1468
/// ```
1469
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1470
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1471
#[allow(clippy::exhaustive_structs)] // newtype
1472
#[repr(transparent)]
1473
pub struct SentenceBreak(pub(crate) u8);
1474
1475
impl SentenceBreak {
1476
    /// Returns an ICU4C `USentenceBreak` value.
1477
0
    pub const fn to_icu4c_value(self) -> u8 {
1478
0
        self.0
1479
0
    }
1480
    /// Constructor from an ICU4C `USentenceBreak` value.
1481
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1482
0
        Self(value)
1483
0
    }
1484
}
1485
1486
create_const_array! {
1487
#[allow(missing_docs)] // These constants don't need individual documentation.
1488
#[allow(non_upper_case_globals)]
1489
impl SentenceBreak {
1490
    pub const Other: SentenceBreak = SentenceBreak(0); // name="XX"
1491
    pub const ATerm: SentenceBreak = SentenceBreak(1); // name="AT"
1492
    pub const Close: SentenceBreak = SentenceBreak(2); // name="CL"
1493
    pub const Format: SentenceBreak = SentenceBreak(3); // name="FO"
1494
    pub const Lower: SentenceBreak = SentenceBreak(4); // name="LO"
1495
    pub const Numeric: SentenceBreak = SentenceBreak(5); // name="NU"
1496
    pub const OLetter: SentenceBreak = SentenceBreak(6); // name="LE"
1497
    pub const Sep: SentenceBreak = SentenceBreak(7); // name="SE"
1498
    pub const Sp: SentenceBreak = SentenceBreak(8); // name="SP"
1499
    pub const STerm: SentenceBreak = SentenceBreak(9); // name="ST"
1500
    pub const Upper: SentenceBreak = SentenceBreak(10); // name="UP"
1501
    pub const CR: SentenceBreak = SentenceBreak(11); // name="CR"
1502
    pub const Extend: SentenceBreak = SentenceBreak(12); // name="EX"
1503
    pub const LF: SentenceBreak = SentenceBreak(13); // name="LF"
1504
    pub const SContinue: SentenceBreak = SentenceBreak(14); // name="SC"
1505
}
1506
#[test]
1507
fn sentence_break_consts();
1508
}
1509
1510
make_enumerated_property! {
1511
    name: "Sentence_Break";
1512
    short_name: "SB";
1513
    ident: SentenceBreak;
1514
    data_marker: crate::provider::PropertyEnumSentenceBreakV1;
1515
    singleton: SINGLETON_PROPERTY_ENUM_SENTENCE_BREAK_V1;
1516
    ule_ty: u8;
1517
}
1518
1519
/// Property `Canonical_Combining_Class`.
1520
/// See UAX #15:
1521
/// <https://www.unicode.org/reports/tr15/>.
1522
///
1523
/// See `icu::normalizer::properties::CanonicalCombiningClassMap` for the API
1524
/// to look up the `Canonical_Combining_Class` property by scalar value.
1525
///
1526
/// **Note:** See `icu::normalizer::CanonicalCombiningClassMap` for the preferred API
1527
/// to look up the `Canonical_Combining_Class` property by scalar value.
1528
///
1529
/// # Example
1530
///
1531
/// ```
1532
/// use icu::properties::{props::CanonicalCombiningClass, CodePointMapData};
1533
///
1534
/// assert_eq!(
1535
///     CodePointMapData::<CanonicalCombiningClass>::new().get('a'),
1536
///     CanonicalCombiningClass::NotReordered
1537
/// ); // U+0061: LATIN SMALL LETTER A
1538
/// assert_eq!(
1539
///     CodePointMapData::<CanonicalCombiningClass>::new().get('\u{0301}'),
1540
///     CanonicalCombiningClass::Above
1541
/// ); // U+0301: COMBINING ACUTE ACCENT
1542
/// ```
1543
//
1544
// NOTE: The Pernosco debugger has special knowledge
1545
// of this struct. Please do not change the bit layout
1546
// or the crate-module-qualified name of this struct
1547
// without coordination.
1548
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1549
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1550
#[allow(clippy::exhaustive_structs)] // newtype
1551
#[repr(transparent)]
1552
pub struct CanonicalCombiningClass(pub(crate) u8);
1553
1554
impl CanonicalCombiningClass {
1555
    /// Returns an ICU4C `UCanonicalCombiningClass` value.
1556
0
    pub const fn to_icu4c_value(self) -> u8 {
1557
0
        self.0
1558
0
    }
1559
    /// Constructor from an ICU4C `UCanonicalCombiningClass` value.
1560
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1561
0
        Self(value)
1562
0
    }
1563
}
1564
1565
create_const_array! {
1566
// These constant names come from PropertyValueAliases.txt
1567
#[allow(missing_docs)] // These constants don't need individual documentation.
1568
#[allow(non_upper_case_globals)]
1569
impl CanonicalCombiningClass {
1570
    pub const NotReordered: CanonicalCombiningClass = CanonicalCombiningClass(0); // name="NR"
1571
    pub const Overlay: CanonicalCombiningClass = CanonicalCombiningClass(1); // name="OV"
1572
    pub const HanReading: CanonicalCombiningClass = CanonicalCombiningClass(6); // name="HANR"
1573
    pub const Nukta: CanonicalCombiningClass = CanonicalCombiningClass(7); // name="NK"
1574
    pub const KanaVoicing: CanonicalCombiningClass = CanonicalCombiningClass(8); // name="KV"
1575
    pub const Virama: CanonicalCombiningClass = CanonicalCombiningClass(9); // name="VR"
1576
    pub const CCC10: CanonicalCombiningClass = CanonicalCombiningClass(10); // name="CCC10"
1577
    pub const CCC11: CanonicalCombiningClass = CanonicalCombiningClass(11); // name="CCC11"
1578
    pub const CCC12: CanonicalCombiningClass = CanonicalCombiningClass(12); // name="CCC12"
1579
    pub const CCC13: CanonicalCombiningClass = CanonicalCombiningClass(13); // name="CCC13"
1580
    pub const CCC14: CanonicalCombiningClass = CanonicalCombiningClass(14); // name="CCC14"
1581
    pub const CCC15: CanonicalCombiningClass = CanonicalCombiningClass(15); // name="CCC15"
1582
    pub const CCC16: CanonicalCombiningClass = CanonicalCombiningClass(16); // name="CCC16"
1583
    pub const CCC17: CanonicalCombiningClass = CanonicalCombiningClass(17); // name="CCC17"
1584
    pub const CCC18: CanonicalCombiningClass = CanonicalCombiningClass(18); // name="CCC18"
1585
    pub const CCC19: CanonicalCombiningClass = CanonicalCombiningClass(19); // name="CCC19"
1586
    pub const CCC20: CanonicalCombiningClass = CanonicalCombiningClass(20); // name="CCC20"
1587
    pub const CCC21: CanonicalCombiningClass = CanonicalCombiningClass(21); // name="CCC21"
1588
    pub const CCC22: CanonicalCombiningClass = CanonicalCombiningClass(22); // name="CCC22"
1589
    pub const CCC23: CanonicalCombiningClass = CanonicalCombiningClass(23); // name="CCC23"
1590
    pub const CCC24: CanonicalCombiningClass = CanonicalCombiningClass(24); // name="CCC24"
1591
    pub const CCC25: CanonicalCombiningClass = CanonicalCombiningClass(25); // name="CCC25"
1592
    pub const CCC26: CanonicalCombiningClass = CanonicalCombiningClass(26); // name="CCC26"
1593
    pub const CCC27: CanonicalCombiningClass = CanonicalCombiningClass(27); // name="CCC27"
1594
    pub const CCC28: CanonicalCombiningClass = CanonicalCombiningClass(28); // name="CCC28"
1595
    pub const CCC29: CanonicalCombiningClass = CanonicalCombiningClass(29); // name="CCC29"
1596
    pub const CCC30: CanonicalCombiningClass = CanonicalCombiningClass(30); // name="CCC30"
1597
    pub const CCC31: CanonicalCombiningClass = CanonicalCombiningClass(31); // name="CCC31"
1598
    pub const CCC32: CanonicalCombiningClass = CanonicalCombiningClass(32); // name="CCC32"
1599
    pub const CCC33: CanonicalCombiningClass = CanonicalCombiningClass(33); // name="CCC33"
1600
    pub const CCC34: CanonicalCombiningClass = CanonicalCombiningClass(34); // name="CCC34"
1601
    pub const CCC35: CanonicalCombiningClass = CanonicalCombiningClass(35); // name="CCC35"
1602
    pub const CCC36: CanonicalCombiningClass = CanonicalCombiningClass(36); // name="CCC36"
1603
    pub const CCC84: CanonicalCombiningClass = CanonicalCombiningClass(84); // name="CCC84"
1604
    pub const CCC91: CanonicalCombiningClass = CanonicalCombiningClass(91); // name="CCC91"
1605
    pub const CCC103: CanonicalCombiningClass = CanonicalCombiningClass(103); // name="CCC103"
1606
    pub const CCC107: CanonicalCombiningClass = CanonicalCombiningClass(107); // name="CCC107"
1607
    pub const CCC118: CanonicalCombiningClass = CanonicalCombiningClass(118); // name="CCC118"
1608
    pub const CCC122: CanonicalCombiningClass = CanonicalCombiningClass(122); // name="CCC122"
1609
    pub const CCC129: CanonicalCombiningClass = CanonicalCombiningClass(129); // name="CCC129"
1610
    pub const CCC130: CanonicalCombiningClass = CanonicalCombiningClass(130); // name="CCC130"
1611
    pub const CCC132: CanonicalCombiningClass = CanonicalCombiningClass(132); // name="CCC132"
1612
    pub const CCC133: CanonicalCombiningClass = CanonicalCombiningClass(133); // name="CCC133" // RESERVED
1613
    pub const AttachedBelowLeft: CanonicalCombiningClass = CanonicalCombiningClass(200); // name="ATBL"
1614
    pub const AttachedBelow: CanonicalCombiningClass = CanonicalCombiningClass(202); // name="ATB"
1615
    pub const AttachedAbove: CanonicalCombiningClass = CanonicalCombiningClass(214); // name="ATA"
1616
    pub const AttachedAboveRight: CanonicalCombiningClass = CanonicalCombiningClass(216); // name="ATAR"
1617
    pub const BelowLeft: CanonicalCombiningClass = CanonicalCombiningClass(218); // name="BL"
1618
    pub const Below: CanonicalCombiningClass = CanonicalCombiningClass(220); // name="B"
1619
    pub const BelowRight: CanonicalCombiningClass = CanonicalCombiningClass(222); // name="BR"
1620
    pub const Left: CanonicalCombiningClass = CanonicalCombiningClass(224); // name="L"
1621
    pub const Right: CanonicalCombiningClass = CanonicalCombiningClass(226); // name="R"
1622
    pub const AboveLeft: CanonicalCombiningClass = CanonicalCombiningClass(228); // name="AL"
1623
    pub const Above: CanonicalCombiningClass = CanonicalCombiningClass(230); // name="A"
1624
    pub const AboveRight: CanonicalCombiningClass = CanonicalCombiningClass(232); // name="AR"
1625
    pub const DoubleBelow: CanonicalCombiningClass = CanonicalCombiningClass(233); // name="DB"
1626
    pub const DoubleAbove: CanonicalCombiningClass = CanonicalCombiningClass(234); // name="DA"
1627
    pub const IotaSubscript: CanonicalCombiningClass = CanonicalCombiningClass(240); // name="IS"
1628
}
1629
#[test]
1630
fn ccc_consts();
1631
}
1632
1633
make_enumerated_property! {
1634
    name: "Canonical_Combining_Class";
1635
    short_name: "ccc";
1636
    ident: CanonicalCombiningClass;
1637
    data_marker: crate::provider::PropertyEnumCanonicalCombiningClassV1;
1638
    singleton: SINGLETON_PROPERTY_ENUM_CANONICAL_COMBINING_CLASS_V1;
1639
    ule_ty: u8;
1640
}
1641
1642
/// Property `Indic_Conjunct_Break`.
1643
/// See UAX #44:
1644
/// <https://www.unicode.org/reports/tr44/#Indic_Conjunct_Break>.
1645
///
1646
/// # Example
1647
///
1648
/// ```
1649
/// use icu::properties::{props::IndicConjunctBreak, CodePointMapData};
1650
///
1651
/// assert_eq!(
1652
///     CodePointMapData::<IndicConjunctBreak>::new().get('a'),
1653
///     IndicConjunctBreak::None
1654
/// );
1655
/// assert_eq!(
1656
///     CodePointMapData::<IndicConjunctBreak>::new().get('\u{094d}'),
1657
///     IndicConjunctBreak::Linker
1658
/// );
1659
/// assert_eq!(
1660
///     CodePointMapData::<IndicConjunctBreak>::new().get('\u{0915}'),
1661
///     IndicConjunctBreak::Consonant
1662
/// );
1663
/// assert_eq!(
1664
///     CodePointMapData::<IndicConjunctBreak>::new().get('\u{0300}'),
1665
///     IndicConjunctBreak::Extend
1666
/// );
1667
/// ```
1668
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1669
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1670
#[allow(clippy::exhaustive_structs)] // newtype
1671
#[repr(transparent)]
1672
pub struct IndicConjunctBreak(pub(crate) u8);
1673
1674
impl IndicConjunctBreak {
1675
    /// Returns an ICU4C `UIndicConjunctBreak` value.
1676
0
    pub const fn to_icu4c_value(self) -> u8 {
1677
0
        self.0
1678
0
    }
1679
    /// Constructor from an ICU4C `UIndicConjunctBreak` value.
1680
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1681
0
        Self(value)
1682
0
    }
1683
}
1684
1685
create_const_array! {
1686
#[allow(missing_docs)] // These constants don't need individual documentation.
1687
#[allow(non_upper_case_globals)]
1688
impl IndicConjunctBreak {
1689
    pub const None: IndicConjunctBreak = IndicConjunctBreak(0);
1690
    pub const Consonant: IndicConjunctBreak = IndicConjunctBreak(1);
1691
    pub const Extend: IndicConjunctBreak = IndicConjunctBreak(2);
1692
    pub const Linker: IndicConjunctBreak = IndicConjunctBreak(3);
1693
}
1694
#[test]
1695
fn indic_conjunct_break_consts();
1696
}
1697
1698
make_enumerated_property! {
1699
    name: "Indic_Conjunct_Break";
1700
    short_name: "InCB";
1701
    ident: IndicConjunctBreak;
1702
    data_marker: crate::provider::PropertyEnumIndicConjunctBreakV1;
1703
    singleton: SINGLETON_PROPERTY_ENUM_INDIC_CONJUNCT_BREAK_V1;
1704
    ule_ty: u8;
1705
}
1706
1707
/// Property `Indic_Syllabic_Category`.
1708
/// See UAX #44:
1709
/// <https://www.unicode.org/reports/tr44/#Indic_Syllabic_Category>.
1710
///
1711
/// # Example
1712
///
1713
/// ```
1714
/// use icu::properties::{props::IndicSyllabicCategory, CodePointMapData};
1715
///
1716
/// assert_eq!(
1717
///     CodePointMapData::<IndicSyllabicCategory>::new().get('a'),
1718
///     IndicSyllabicCategory::Other
1719
/// );
1720
/// assert_eq!(
1721
///     CodePointMapData::<IndicSyllabicCategory>::new().get('\u{0900}'),
1722
///     IndicSyllabicCategory::Bindu
1723
/// ); // U+0900: DEVANAGARI SIGN INVERTED CANDRABINDU
1724
/// ```
1725
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1726
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1727
#[allow(clippy::exhaustive_structs)] // newtype
1728
#[repr(transparent)]
1729
pub struct IndicSyllabicCategory(pub(crate) u8);
1730
1731
impl IndicSyllabicCategory {
1732
    /// Returns an ICU4C `UIndicSyllabicCategory` value.
1733
0
    pub const fn to_icu4c_value(self) -> u8 {
1734
0
        self.0
1735
0
    }
1736
    /// Constructor from an ICU4C `UIndicSyllabicCategory` value.
1737
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1738
0
        Self(value)
1739
0
    }
1740
}
1741
1742
create_const_array! {
1743
#[allow(missing_docs)] // These constants don't need individual documentation.
1744
#[allow(non_upper_case_globals)]
1745
impl IndicSyllabicCategory {
1746
    pub const Other: IndicSyllabicCategory = IndicSyllabicCategory(0);
1747
    pub const Avagraha: IndicSyllabicCategory = IndicSyllabicCategory(1);
1748
    pub const Bindu: IndicSyllabicCategory = IndicSyllabicCategory(2);
1749
    pub const BrahmiJoiningNumber: IndicSyllabicCategory = IndicSyllabicCategory(3);
1750
    pub const CantillationMark: IndicSyllabicCategory = IndicSyllabicCategory(4);
1751
    pub const Consonant: IndicSyllabicCategory = IndicSyllabicCategory(5);
1752
    pub const ConsonantDead: IndicSyllabicCategory = IndicSyllabicCategory(6);
1753
    pub const ConsonantFinal: IndicSyllabicCategory = IndicSyllabicCategory(7);
1754
    pub const ConsonantHeadLetter: IndicSyllabicCategory = IndicSyllabicCategory(8);
1755
    pub const ConsonantInitialPostfixed: IndicSyllabicCategory = IndicSyllabicCategory(9);
1756
    pub const ConsonantKiller: IndicSyllabicCategory = IndicSyllabicCategory(10);
1757
    pub const ConsonantMedial: IndicSyllabicCategory = IndicSyllabicCategory(11);
1758
    pub const ConsonantPlaceholder: IndicSyllabicCategory = IndicSyllabicCategory(12);
1759
    pub const ConsonantPrecedingRepha: IndicSyllabicCategory = IndicSyllabicCategory(13);
1760
    pub const ConsonantPrefixed: IndicSyllabicCategory = IndicSyllabicCategory(14);
1761
    pub const ConsonantSubjoined: IndicSyllabicCategory = IndicSyllabicCategory(15);
1762
    pub const ConsonantSucceedingRepha: IndicSyllabicCategory = IndicSyllabicCategory(16);
1763
    pub const ConsonantWithStacker: IndicSyllabicCategory = IndicSyllabicCategory(17);
1764
    pub const GeminationMark: IndicSyllabicCategory = IndicSyllabicCategory(18);
1765
    pub const InvisibleStacker: IndicSyllabicCategory = IndicSyllabicCategory(19);
1766
    pub const Joiner: IndicSyllabicCategory = IndicSyllabicCategory(20);
1767
    pub const ModifyingLetter: IndicSyllabicCategory = IndicSyllabicCategory(21);
1768
    pub const NonJoiner: IndicSyllabicCategory = IndicSyllabicCategory(22);
1769
    pub const Nukta: IndicSyllabicCategory = IndicSyllabicCategory(23);
1770
    pub const Number: IndicSyllabicCategory = IndicSyllabicCategory(24);
1771
    pub const NumberJoiner: IndicSyllabicCategory = IndicSyllabicCategory(25);
1772
    pub const PureKiller: IndicSyllabicCategory = IndicSyllabicCategory(26);
1773
    pub const RegisterShifter: IndicSyllabicCategory = IndicSyllabicCategory(27);
1774
    pub const SyllableModifier: IndicSyllabicCategory = IndicSyllabicCategory(28);
1775
    pub const ToneLetter: IndicSyllabicCategory = IndicSyllabicCategory(29);
1776
    pub const ToneMark: IndicSyllabicCategory = IndicSyllabicCategory(30);
1777
    pub const Virama: IndicSyllabicCategory = IndicSyllabicCategory(31);
1778
    pub const Visarga: IndicSyllabicCategory = IndicSyllabicCategory(32);
1779
    pub const Vowel: IndicSyllabicCategory = IndicSyllabicCategory(33);
1780
    pub const VowelDependent: IndicSyllabicCategory = IndicSyllabicCategory(34);
1781
    pub const VowelIndependent: IndicSyllabicCategory = IndicSyllabicCategory(35);
1782
    pub const ReorderingKiller: IndicSyllabicCategory = IndicSyllabicCategory(36);
1783
}
1784
#[test]
1785
fn indic_syllabic_category_consts();
1786
}
1787
1788
make_enumerated_property! {
1789
    name: "Indic_Syllabic_Category";
1790
    short_name: "InSC";
1791
    ident: IndicSyllabicCategory;
1792
    data_marker: crate::provider::PropertyEnumIndicSyllabicCategoryV1;
1793
    singleton: SINGLETON_PROPERTY_ENUM_INDIC_SYLLABIC_CATEGORY_V1;
1794
    ule_ty: u8;
1795
}
1796
1797
/// Enumerated property `Joining_Group`.
1798
///
1799
/// See Section 9.2, Arabic Joining Groups in The Unicode Standard for the summary of
1800
/// each property value.
1801
///
1802
/// ```
1803
/// use icu::properties::{props::JoiningGroup, CodePointMapData};
1804
///
1805
/// assert_eq!(
1806
///     CodePointMapData::<JoiningGroup>::new().get('ع'),
1807
///     JoiningGroup::Ain,
1808
/// ); // U+0639: Arabic Letter Ain
1809
/// assert_eq!(
1810
///     CodePointMapData::<JoiningGroup>::new().get('ظ'),
1811
///     JoiningGroup::Tah,
1812
/// ); // U+0638: Arabic Letter Zah
1813
/// ```
1814
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1815
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1816
#[allow(clippy::exhaustive_structs)] // newtype
1817
#[repr(transparent)]
1818
pub struct JoiningGroup(pub(crate) u8);
1819
1820
impl JoiningGroup {
1821
    /// Returns an ICU4C `UJoiningType` value.
1822
0
    pub const fn to_icu4c_value(self) -> u8 {
1823
0
        self.0
1824
0
    }
1825
    /// Constructor from an ICU4C `UJoiningType` value.
1826
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1827
0
        Self(value)
1828
0
    }
1829
}
1830
1831
create_const_array! {
1832
#[allow(missing_docs)] // These constants don't need individual documentation.
1833
#[allow(non_upper_case_globals)]
1834
impl JoiningGroup {
1835
    pub const NoJoiningGroup: JoiningGroup = JoiningGroup(0);
1836
    pub const Ain: JoiningGroup = JoiningGroup(1);
1837
    pub const Alaph: JoiningGroup = JoiningGroup(2);
1838
    pub const Alef: JoiningGroup = JoiningGroup(3);
1839
    pub const Beh: JoiningGroup = JoiningGroup(4);
1840
    pub const Beth: JoiningGroup = JoiningGroup(5);
1841
    pub const Dal: JoiningGroup = JoiningGroup(6);
1842
    pub const DalathRish: JoiningGroup = JoiningGroup(7);
1843
    pub const E: JoiningGroup = JoiningGroup(8);
1844
    pub const Feh: JoiningGroup = JoiningGroup(9);
1845
    pub const FinalSemkath: JoiningGroup = JoiningGroup(10);
1846
    pub const Gaf: JoiningGroup = JoiningGroup(11);
1847
    pub const Gamal: JoiningGroup = JoiningGroup(12);
1848
    pub const Hah: JoiningGroup = JoiningGroup(13);
1849
    pub const TehMarbutaGoal: JoiningGroup = JoiningGroup(14);
1850
    pub const He: JoiningGroup = JoiningGroup(15);
1851
    pub const Heh: JoiningGroup = JoiningGroup(16);
1852
    pub const HehGoal: JoiningGroup = JoiningGroup(17);
1853
    pub const Heth: JoiningGroup = JoiningGroup(18);
1854
    pub const Kaf: JoiningGroup = JoiningGroup(19);
1855
    pub const Kaph: JoiningGroup = JoiningGroup(20);
1856
    pub const KnottedHeh: JoiningGroup = JoiningGroup(21);
1857
    pub const Lam: JoiningGroup = JoiningGroup(22);
1858
    pub const Lamadh: JoiningGroup = JoiningGroup(23);
1859
    pub const Meem: JoiningGroup = JoiningGroup(24);
1860
    pub const Mim: JoiningGroup = JoiningGroup(25);
1861
    pub const Noon: JoiningGroup = JoiningGroup(26);
1862
    pub const Nun: JoiningGroup = JoiningGroup(27);
1863
    pub const Pe: JoiningGroup = JoiningGroup(28);
1864
    pub const Qaf: JoiningGroup = JoiningGroup(29);
1865
    pub const Qaph: JoiningGroup = JoiningGroup(30);
1866
    pub const Reh: JoiningGroup = JoiningGroup(31);
1867
    pub const ReversedPe: JoiningGroup = JoiningGroup(32);
1868
    pub const Sad: JoiningGroup = JoiningGroup(33);
1869
    pub const Sadhe: JoiningGroup = JoiningGroup(34);
1870
    pub const Seen: JoiningGroup = JoiningGroup(35);
1871
    pub const Semkath: JoiningGroup = JoiningGroup(36);
1872
    pub const Shin: JoiningGroup = JoiningGroup(37);
1873
    pub const SwashKaf: JoiningGroup = JoiningGroup(38);
1874
    pub const SyriacWaw: JoiningGroup = JoiningGroup(39);
1875
    pub const Tah: JoiningGroup = JoiningGroup(40);
1876
    pub const Taw: JoiningGroup = JoiningGroup(41);
1877
    pub const TehMarbuta: JoiningGroup = JoiningGroup(42);
1878
    pub const Teth: JoiningGroup = JoiningGroup(43);
1879
    pub const Waw: JoiningGroup = JoiningGroup(44);
1880
    pub const Yeh: JoiningGroup = JoiningGroup(45);
1881
    pub const YehBarree: JoiningGroup = JoiningGroup(46);
1882
    pub const YehWithTail: JoiningGroup = JoiningGroup(47);
1883
    pub const Yudh: JoiningGroup = JoiningGroup(48);
1884
    pub const YudhHe: JoiningGroup = JoiningGroup(49);
1885
    pub const Zain: JoiningGroup = JoiningGroup(50);
1886
    pub const Fe: JoiningGroup = JoiningGroup(51);
1887
    pub const Khaph: JoiningGroup = JoiningGroup(52);
1888
    pub const Zhain: JoiningGroup = JoiningGroup(53);
1889
    pub const BurushaskiYehBarree: JoiningGroup = JoiningGroup(54);
1890
    pub const FarsiYeh: JoiningGroup = JoiningGroup(55);
1891
    pub const Nya: JoiningGroup = JoiningGroup(56);
1892
    pub const RohingyaYeh: JoiningGroup = JoiningGroup(57);
1893
    pub const ManichaeanAleph: JoiningGroup = JoiningGroup(58);
1894
    pub const ManichaeanAyin: JoiningGroup = JoiningGroup(59);
1895
    pub const ManichaeanBeth: JoiningGroup = JoiningGroup(60);
1896
    pub const ManichaeanDaleth: JoiningGroup = JoiningGroup(61);
1897
    pub const ManichaeanDhamedh: JoiningGroup = JoiningGroup(62);
1898
    pub const ManichaeanFive: JoiningGroup = JoiningGroup(63);
1899
    pub const ManichaeanGimel: JoiningGroup = JoiningGroup(64);
1900
    pub const ManichaeanHeth: JoiningGroup = JoiningGroup(65);
1901
    pub const ManichaeanHundred: JoiningGroup = JoiningGroup(66);
1902
    pub const ManichaeanKaph: JoiningGroup = JoiningGroup(67);
1903
    pub const ManichaeanLamedh: JoiningGroup = JoiningGroup(68);
1904
    pub const ManichaeanMem: JoiningGroup = JoiningGroup(69);
1905
    pub const ManichaeanNun: JoiningGroup = JoiningGroup(70);
1906
    pub const ManichaeanOne: JoiningGroup = JoiningGroup(71);
1907
    pub const ManichaeanPe: JoiningGroup = JoiningGroup(72);
1908
    pub const ManichaeanQoph: JoiningGroup = JoiningGroup(73);
1909
    pub const ManichaeanResh: JoiningGroup = JoiningGroup(74);
1910
    pub const ManichaeanSadhe: JoiningGroup = JoiningGroup(75);
1911
    pub const ManichaeanSamekh: JoiningGroup = JoiningGroup(76);
1912
    pub const ManichaeanTaw: JoiningGroup = JoiningGroup(77);
1913
    pub const ManichaeanTen: JoiningGroup = JoiningGroup(78);
1914
    pub const ManichaeanTeth: JoiningGroup = JoiningGroup(79);
1915
    pub const ManichaeanThamedh: JoiningGroup = JoiningGroup(80);
1916
    pub const ManichaeanTwenty: JoiningGroup = JoiningGroup(81);
1917
    pub const ManichaeanWaw: JoiningGroup = JoiningGroup(82);
1918
    pub const ManichaeanYodh: JoiningGroup = JoiningGroup(83);
1919
    pub const ManichaeanZayin: JoiningGroup = JoiningGroup(84);
1920
    pub const StraightWaw: JoiningGroup = JoiningGroup(85);
1921
    pub const AfricanFeh: JoiningGroup = JoiningGroup(86);
1922
    pub const AfricanNoon: JoiningGroup = JoiningGroup(87);
1923
    pub const AfricanQaf: JoiningGroup = JoiningGroup(88);
1924
    pub const MalayalamBha: JoiningGroup = JoiningGroup(89);
1925
    pub const MalayalamJa: JoiningGroup = JoiningGroup(90);
1926
    pub const MalayalamLla: JoiningGroup = JoiningGroup(91);
1927
    pub const MalayalamLlla: JoiningGroup = JoiningGroup(92);
1928
    pub const MalayalamNga: JoiningGroup = JoiningGroup(93);
1929
    pub const MalayalamNna: JoiningGroup = JoiningGroup(94);
1930
    pub const MalayalamNnna: JoiningGroup = JoiningGroup(95);
1931
    pub const MalayalamNya: JoiningGroup = JoiningGroup(96);
1932
    pub const MalayalamRa: JoiningGroup = JoiningGroup(97);
1933
    pub const MalayalamSsa: JoiningGroup = JoiningGroup(98);
1934
    pub const MalayalamTta: JoiningGroup = JoiningGroup(99);
1935
    pub const HanifiRohingyaKinnaYa: JoiningGroup = JoiningGroup(100);
1936
    pub const HanifiRohingyaPa: JoiningGroup = JoiningGroup(101);
1937
    pub const ThinYeh: JoiningGroup = JoiningGroup(102);
1938
    pub const VerticalTail: JoiningGroup = JoiningGroup(103);
1939
    pub const KashmiriYeh: JoiningGroup = JoiningGroup(104);
1940
    pub const ThinNoon: JoiningGroup = JoiningGroup(105);
1941
}
1942
#[test]
1943
fn joining_group_consts();
1944
}
1945
1946
make_enumerated_property! {
1947
    name: "Joining_Group";
1948
    short_name: "jg";
1949
    ident: JoiningGroup;
1950
    data_marker: crate::provider::PropertyEnumJoiningGroupV1;
1951
    singleton: SINGLETON_PROPERTY_ENUM_JOINING_GROUP_V1;
1952
    ule_ty: u8;
1953
}
1954
1955
/// Enumerated property `Joining_Type`.
1956
///
1957
/// See Section 9.2, Arabic Cursive Joining in The Unicode Standard for the summary of
1958
/// each property value.
1959
///
1960
/// # Example
1961
///
1962
/// ```
1963
/// use icu::properties::{props::JoiningType, CodePointMapData};
1964
///
1965
/// assert_eq!(
1966
///     CodePointMapData::<JoiningType>::new().get('ؠ'),
1967
///     JoiningType::DualJoining
1968
/// ); // U+0620: Arabic Letter Kashmiri Yeh
1969
/// assert_eq!(
1970
///     CodePointMapData::<JoiningType>::new().get('𐫍'),
1971
///     JoiningType::LeftJoining
1972
/// ); // U+10ACD: Manichaean Letter Heth
1973
/// ```
1974
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1975
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1976
#[allow(clippy::exhaustive_structs)] // newtype
1977
#[repr(transparent)]
1978
pub struct JoiningType(pub(crate) u8);
1979
1980
impl JoiningType {
1981
    /// Returns an ICU4C `UJoiningType` value.
1982
0
    pub const fn to_icu4c_value(self) -> u8 {
1983
0
        self.0
1984
0
    }
1985
    /// Constructor from an ICU4C `UJoiningType` value.
1986
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1987
0
        Self(value)
1988
0
    }
1989
}
1990
1991
create_const_array! {
1992
#[allow(missing_docs)] // These constants don't need individual documentation.
1993
#[allow(non_upper_case_globals)]
1994
impl JoiningType {
1995
    pub const NonJoining: JoiningType = JoiningType(0); // name="U"
1996
    pub const JoinCausing: JoiningType = JoiningType(1); // name="C"
1997
    pub const DualJoining: JoiningType = JoiningType(2); // name="D"
1998
    pub const LeftJoining: JoiningType = JoiningType(3); // name="L"
1999
    pub const RightJoining: JoiningType = JoiningType(4); // name="R"
2000
    pub const Transparent: JoiningType = JoiningType(5); // name="T"
2001
}
2002
#[test]
2003
fn joining_type_consts();
2004
}
2005
2006
make_enumerated_property! {
2007
    name: "Joining_Type";
2008
    short_name: "jt";
2009
    ident: JoiningType;
2010
    data_marker: crate::provider::PropertyEnumJoiningTypeV1;
2011
    singleton: SINGLETON_PROPERTY_ENUM_JOINING_TYPE_V1;
2012
    ule_ty: u8;
2013
}
2014
2015
/// Property `Vertical_Orientation`
2016
///
2017
/// See UTR #50:
2018
/// <https://www.unicode.org/reports/tr50/#vo>
2019
///
2020
/// # Example
2021
///
2022
/// ```
2023
/// use icu::properties::{props::VerticalOrientation, CodePointMapData};
2024
///
2025
/// assert_eq!(
2026
///     CodePointMapData::<VerticalOrientation>::new().get('a'),
2027
///     VerticalOrientation::Rotated
2028
/// );
2029
/// assert_eq!(
2030
///     CodePointMapData::<VerticalOrientation>::new().get('§'),
2031
///     VerticalOrientation::Upright
2032
/// );
2033
/// assert_eq!(
2034
///     CodePointMapData::<VerticalOrientation>::new().get32(0x2329),
2035
///     VerticalOrientation::TransformedRotated
2036
/// );
2037
/// assert_eq!(
2038
///     CodePointMapData::<VerticalOrientation>::new().get32(0x3001),
2039
///     VerticalOrientation::TransformedUpright
2040
/// );
2041
/// ```
2042
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
2043
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2044
#[allow(clippy::exhaustive_structs)] // newtype
2045
#[repr(transparent)]
2046
pub struct VerticalOrientation(pub(crate) u8);
2047
2048
impl VerticalOrientation {
2049
    /// Returns an ICU4C `UVerticalOrientation` value.
2050
0
    pub const fn to_icu4c_value(self) -> u8 {
2051
0
        self.0
2052
0
    }
2053
    /// Constructor from an ICU4C `UVerticalOrientation` value.
2054
0
    pub const fn from_icu4c_value(value: u8) -> Self {
2055
0
        Self(value)
2056
0
    }
2057
}
2058
2059
create_const_array! {
2060
#[allow(missing_docs)] // These constants don't need individual documentation.
2061
#[allow(non_upper_case_globals)]
2062
impl VerticalOrientation {
2063
    pub const Rotated: VerticalOrientation = VerticalOrientation(0); // name="R"
2064
    pub const TransformedRotated: VerticalOrientation = VerticalOrientation(1); // name="Tr"
2065
    pub const TransformedUpright: VerticalOrientation = VerticalOrientation(2); // name="Tu"
2066
    pub const Upright: VerticalOrientation = VerticalOrientation(3); // name="U"
2067
}
2068
#[test]
2069
fn vertical_orientation_consts();
2070
}
2071
2072
make_enumerated_property! {
2073
    name: "Vertical_Orientation";
2074
    short_name: "vo";
2075
    ident: VerticalOrientation;
2076
    data_marker: crate::provider::PropertyEnumVerticalOrientationV1;
2077
    singleton: SINGLETON_PROPERTY_ENUM_VERTICAL_ORIENTATION_V1;
2078
    ule_ty: u8;
2079
}
2080
2081
pub use crate::code_point_set::BinaryProperty;
2082
2083
macro_rules! make_binary_property {
2084
    (
2085
        name: $name:literal;
2086
        short_name: $short_name:literal;
2087
        ident: $ident:ident;
2088
        data_marker: $data_marker:ty;
2089
        singleton: $singleton:ident;
2090
            $(#[$doc:meta])+
2091
    ) => {
2092
        $(#[$doc])+
2093
        #[derive(Debug)]
2094
        #[non_exhaustive]
2095
        pub struct $ident;
2096
2097
        impl crate::private::Sealed for $ident {}
2098
2099
        impl BinaryProperty for $ident {
2100
        type DataMarker = $data_marker;
2101
            #[cfg(feature = "compiled_data")]
2102
            const SINGLETON: &'static crate::provider::PropertyCodePointSet<'static> =
2103
                &crate::provider::Baked::$singleton;
2104
            const NAME: &'static [u8] = $name.as_bytes();
2105
            const SHORT_NAME: &'static [u8] = $short_name.as_bytes();
2106
        }
2107
    };
2108
}
2109
2110
make_binary_property! {
2111
    name: "ASCII_Hex_Digit";
2112
    short_name: "AHex";
2113
    ident: AsciiHexDigit;
2114
    data_marker: crate::provider::PropertyBinaryAsciiHexDigitV1;
2115
    singleton: SINGLETON_PROPERTY_BINARY_ASCII_HEX_DIGIT_V1;
2116
    /// ASCII characters commonly used for the representation of hexadecimal numbers.
2117
    ///
2118
    /// # Example
2119
    ///
2120
    /// ```
2121
    /// use icu::properties::CodePointSetData;
2122
    /// use icu::properties::props::AsciiHexDigit;
2123
    ///
2124
    /// let ascii_hex_digit = CodePointSetData::new::<AsciiHexDigit>();
2125
    ///
2126
    /// assert!(ascii_hex_digit.contains('3'));
2127
    /// assert!(!ascii_hex_digit.contains('੩'));  // U+0A69 GURMUKHI DIGIT THREE
2128
    /// assert!(ascii_hex_digit.contains('A'));
2129
    /// assert!(!ascii_hex_digit.contains('Ä'));  // U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
2130
    /// ```
2131
}
2132
2133
make_binary_property! {
2134
    name: "alnum";
2135
    short_name: "alnum";
2136
    ident: Alnum;
2137
    data_marker: crate::provider::PropertyBinaryAlnumV1;
2138
    singleton: SINGLETON_PROPERTY_BINARY_ALNUM_V1;
2139
    /// Characters with the `Alphabetic` or `Decimal_Number` property.
2140
    ///
2141
    /// This is defined for POSIX compatibility.
2142
}
2143
2144
make_binary_property! {
2145
    name: "Alphabetic";
2146
    short_name: "Alpha";
2147
    ident: Alphabetic;
2148
    data_marker: crate::provider::PropertyBinaryAlphabeticV1;
2149
    singleton: SINGLETON_PROPERTY_BINARY_ALPHABETIC_V1;
2150
    /// Alphabetic characters.
2151
    ///
2152
    /// # Example
2153
    ///
2154
    /// ```
2155
    /// use icu::properties::CodePointSetData;
2156
    /// use icu::properties::props::Alphabetic;
2157
    ///
2158
    /// let alphabetic = CodePointSetData::new::<Alphabetic>();
2159
    ///
2160
    /// assert!(!alphabetic.contains('3'));
2161
    /// assert!(!alphabetic.contains('੩'));  // U+0A69 GURMUKHI DIGIT THREE
2162
    /// assert!(alphabetic.contains('A'));
2163
    /// assert!(alphabetic.contains('Ä'));  // U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
2164
    /// ```
2165
2166
}
2167
2168
make_binary_property! {
2169
    name: "Bidi_Control";
2170
    short_name: "Bidi_C";
2171
    ident: BidiControl;
2172
    data_marker: crate::provider::PropertyBinaryBidiControlV1;
2173
    singleton: SINGLETON_PROPERTY_BINARY_BIDI_CONTROL_V1;
2174
    /// Format control characters which have specific functions in the Unicode Bidirectional
2175
    /// Algorithm.
2176
    ///
2177
    /// # Example
2178
    ///
2179
    /// ```
2180
    /// use icu::properties::CodePointSetData;
2181
    /// use icu::properties::props::BidiControl;
2182
    ///
2183
    /// let bidi_control = CodePointSetData::new::<BidiControl>();
2184
    ///
2185
    /// assert!(bidi_control.contains('\u{200F}'));  // RIGHT-TO-LEFT MARK
2186
    /// assert!(!bidi_control.contains('ش'));  // U+0634 ARABIC LETTER SHEEN
2187
    /// ```
2188
2189
}
2190
2191
make_binary_property! {
2192
    name: "Bidi_Mirrored";
2193
    short_name: "Bidi_M";
2194
    ident: BidiMirrored;
2195
    data_marker: crate::provider::PropertyBinaryBidiMirroredV1;
2196
    singleton: SINGLETON_PROPERTY_BINARY_BIDI_MIRRORED_V1;
2197
    /// Characters that are mirrored in bidirectional text.
2198
    ///
2199
    /// # Example
2200
    ///
2201
    /// ```
2202
    /// use icu::properties::CodePointSetData;
2203
    /// use icu::properties::props::BidiMirrored;
2204
    ///
2205
    /// let bidi_mirrored = CodePointSetData::new::<BidiMirrored>();
2206
    ///
2207
    /// assert!(bidi_mirrored.contains('['));
2208
    /// assert!(bidi_mirrored.contains(']'));
2209
    /// assert!(bidi_mirrored.contains('∑'));  // U+2211 N-ARY SUMMATION
2210
    /// assert!(!bidi_mirrored.contains('ཉ'));  // U+0F49 TIBETAN LETTER NYA
2211
    /// ```
2212
2213
}
2214
2215
make_binary_property! {
2216
    name: "blank";
2217
    short_name: "blank";
2218
    ident: Blank;
2219
    data_marker: crate::provider::PropertyBinaryBlankV1;
2220
    singleton: SINGLETON_PROPERTY_BINARY_BLANK_V1;
2221
    /// Horizontal whitespace characters
2222
2223
}
2224
2225
make_binary_property! {
2226
    name: "Cased";
2227
    short_name: "Cased";
2228
    ident: Cased;
2229
    data_marker: crate::provider::PropertyBinaryCasedV1;
2230
    singleton: SINGLETON_PROPERTY_BINARY_CASED_V1;
2231
    /// Uppercase, lowercase, and titlecase characters.
2232
    ///
2233
    /// # Example
2234
    ///
2235
    /// ```
2236
    /// use icu::properties::CodePointSetData;
2237
    /// use icu::properties::props::Cased;
2238
    ///
2239
    /// let cased = CodePointSetData::new::<Cased>();
2240
    ///
2241
    /// assert!(cased.contains('Ꙡ'));  // U+A660 CYRILLIC CAPITAL LETTER REVERSED TSE
2242
    /// assert!(!cased.contains('ދ'));  // U+078B THAANA LETTER DHAALU
2243
    /// ```
2244
2245
}
2246
2247
make_binary_property! {
2248
    name: "Case_Ignorable";
2249
    short_name: "CI";
2250
    ident: CaseIgnorable;
2251
    data_marker: crate::provider::PropertyBinaryCaseIgnorableV1;
2252
    singleton: SINGLETON_PROPERTY_BINARY_CASE_IGNORABLE_V1;
2253
    /// Characters which are ignored for casing purposes.
2254
    ///
2255
    /// # Example
2256
    ///
2257
    /// ```
2258
    /// use icu::properties::CodePointSetData;
2259
    /// use icu::properties::props::CaseIgnorable;
2260
    ///
2261
    /// let case_ignorable = CodePointSetData::new::<CaseIgnorable>();
2262
    ///
2263
    /// assert!(case_ignorable.contains(':'));
2264
    /// assert!(!case_ignorable.contains('λ'));  // U+03BB GREEK SMALL LETTER LAMBDA
2265
    /// ```
2266
2267
}
2268
2269
make_binary_property! {
2270
    name: "Full_Composition_Exclusion";
2271
    short_name: "Comp_Ex";
2272
    ident: FullCompositionExclusion;
2273
    data_marker: crate::provider::PropertyBinaryFullCompositionExclusionV1;
2274
    singleton: SINGLETON_PROPERTY_BINARY_FULL_COMPOSITION_EXCLUSION_V1;
2275
    /// Characters that are excluded from composition.
2276
    ///
2277
    /// See <https://unicode.org/Public/UNIDATA/CompositionExclusions.txt>
2278
2279
}
2280
2281
make_binary_property! {
2282
    name: "Changes_When_Casefolded";
2283
    short_name: "CWCF";
2284
    ident: ChangesWhenCasefolded;
2285
    data_marker: crate::provider::PropertyBinaryChangesWhenCasefoldedV1;
2286
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_CASEFOLDED_V1;
2287
    /// Characters whose normalized forms are not stable under case folding.
2288
    ///
2289
    /// # Example
2290
    ///
2291
    /// ```
2292
    /// use icu::properties::CodePointSetData;
2293
    /// use icu::properties::props::ChangesWhenCasefolded;
2294
    ///
2295
    /// let changes_when_casefolded = CodePointSetData::new::<ChangesWhenCasefolded>();
2296
    ///
2297
    /// assert!(changes_when_casefolded.contains('ß'));  // U+00DF LATIN SMALL LETTER SHARP S
2298
    /// assert!(!changes_when_casefolded.contains('ᜉ'));  // U+1709 TAGALOG LETTER PA
2299
    /// ```
2300
2301
}
2302
2303
make_binary_property! {
2304
    name: "Changes_When_Casemapped";
2305
    short_name: "CWCM";
2306
    ident: ChangesWhenCasemapped;
2307
    data_marker: crate::provider::PropertyBinaryChangesWhenCasemappedV1;
2308
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_CASEMAPPED_V1;
2309
    /// Characters which may change when they undergo case mapping.
2310
2311
}
2312
2313
make_binary_property! {
2314
    name: "Changes_When_NFKC_Casefolded";
2315
    short_name: "CWKCF";
2316
    ident: ChangesWhenNfkcCasefolded;
2317
    data_marker: crate::provider::PropertyBinaryChangesWhenNfkcCasefoldedV1;
2318
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_NFKC_CASEFOLDED_V1;
2319
    /// Characters which are not identical to their `NFKC_Casefold` mapping.
2320
    ///
2321
    /// # Example
2322
    ///
2323
    /// ```
2324
    /// use icu::properties::CodePointSetData;
2325
    /// use icu::properties::props::ChangesWhenNfkcCasefolded;
2326
    ///
2327
    /// let changes_when_nfkc_casefolded = CodePointSetData::new::<ChangesWhenNfkcCasefolded>();
2328
    ///
2329
    /// assert!(changes_when_nfkc_casefolded.contains('🄵'));  // U+1F135 SQUARED LATIN CAPITAL LETTER F
2330
    /// assert!(!changes_when_nfkc_casefolded.contains('f'));
2331
    /// ```
2332
2333
}
2334
2335
make_binary_property! {
2336
    name: "Changes_When_Lowercased";
2337
    short_name: "CWL";
2338
    ident: ChangesWhenLowercased;
2339
    data_marker: crate::provider::PropertyBinaryChangesWhenLowercasedV1;
2340
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_LOWERCASED_V1;
2341
    /// Characters whose normalized forms are not stable under a `toLowercase` mapping.
2342
    ///
2343
    /// # Example
2344
    ///
2345
    /// ```
2346
    /// use icu::properties::CodePointSetData;
2347
    /// use icu::properties::props::ChangesWhenLowercased;
2348
    ///
2349
    /// let changes_when_lowercased = CodePointSetData::new::<ChangesWhenLowercased>();
2350
    ///
2351
    /// assert!(changes_when_lowercased.contains('Ⴔ'));  // U+10B4 GEORGIAN CAPITAL LETTER PHAR
2352
    /// assert!(!changes_when_lowercased.contains('ფ'));  // U+10E4 GEORGIAN LETTER PHAR
2353
    /// ```
2354
2355
}
2356
2357
make_binary_property! {
2358
    name: "Changes_When_Titlecased";
2359
    short_name: "CWT";
2360
    ident: ChangesWhenTitlecased;
2361
    data_marker: crate::provider::PropertyBinaryChangesWhenTitlecasedV1;
2362
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_TITLECASED_V1;
2363
    /// Characters whose normalized forms are not stable under a `toTitlecase` mapping.
2364
    ///
2365
    /// # Example
2366
    ///
2367
    /// ```
2368
    /// use icu::properties::CodePointSetData;
2369
    /// use icu::properties::props::ChangesWhenTitlecased;
2370
    ///
2371
    /// let changes_when_titlecased = CodePointSetData::new::<ChangesWhenTitlecased>();
2372
    ///
2373
    /// assert!(changes_when_titlecased.contains('æ'));  // U+00E6 LATIN SMALL LETTER AE
2374
    /// assert!(!changes_when_titlecased.contains('Æ'));  // U+00E6 LATIN CAPITAL LETTER AE
2375
    /// ```
2376
2377
}
2378
2379
make_binary_property! {
2380
    name: "Changes_When_Uppercased";
2381
    short_name: "CWU";
2382
    ident: ChangesWhenUppercased;
2383
    data_marker: crate::provider::PropertyBinaryChangesWhenUppercasedV1;
2384
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_UPPERCASED_V1;
2385
    /// Characters whose normalized forms are not stable under a `toUppercase` mapping.
2386
    ///
2387
    /// # Example
2388
    ///
2389
    /// ```
2390
    /// use icu::properties::CodePointSetData;
2391
    /// use icu::properties::props::ChangesWhenUppercased;
2392
    ///
2393
    /// let changes_when_uppercased = CodePointSetData::new::<ChangesWhenUppercased>();
2394
    ///
2395
    /// assert!(changes_when_uppercased.contains('ւ'));  // U+0582 ARMENIAN SMALL LETTER YIWN
2396
    /// assert!(!changes_when_uppercased.contains('Ւ'));  // U+0552 ARMENIAN CAPITAL LETTER YIWN
2397
    /// ```
2398
2399
}
2400
2401
make_binary_property! {
2402
    name: "Dash";
2403
    short_name: "Dash";
2404
    ident: Dash;
2405
    data_marker: crate::provider::PropertyBinaryDashV1;
2406
    singleton: SINGLETON_PROPERTY_BINARY_DASH_V1;
2407
    /// Punctuation characters explicitly called out as dashes in the Unicode Standard, plus
2408
    /// their compatibility equivalents.
2409
    ///
2410
    /// # Example
2411
    ///
2412
    /// ```
2413
    /// use icu::properties::CodePointSetData;
2414
    /// use icu::properties::props::Dash;
2415
    ///
2416
    /// let dash = CodePointSetData::new::<Dash>();
2417
    ///
2418
    /// assert!(dash.contains('⸺'));  // U+2E3A TWO-EM DASH
2419
    /// assert!(dash.contains('-'));  // U+002D
2420
    /// assert!(!dash.contains('='));  // U+003D
2421
    /// ```
2422
2423
}
2424
2425
make_binary_property! {
2426
    name: "Deprecated";
2427
    short_name: "Dep";
2428
    ident: Deprecated;
2429
    data_marker: crate::provider::PropertyBinaryDeprecatedV1;
2430
    singleton: SINGLETON_PROPERTY_BINARY_DEPRECATED_V1;
2431
    /// Deprecated characters.
2432
    ///
2433
    /// No characters will ever be removed from the standard, but the
2434
    /// usage of deprecated characters is strongly discouraged.
2435
    ///
2436
    /// # Example
2437
    ///
2438
    /// ```
2439
    /// use icu::properties::CodePointSetData;
2440
    /// use icu::properties::props::Deprecated;
2441
    ///
2442
    /// let deprecated = CodePointSetData::new::<Deprecated>();
2443
    ///
2444
    /// assert!(deprecated.contains('ឣ'));  // U+17A3 KHMER INDEPENDENT VOWEL QAQ
2445
    /// assert!(!deprecated.contains('A'));
2446
    /// ```
2447
2448
}
2449
2450
make_binary_property! {
2451
    name: "Default_Ignorable_Code_Point";
2452
    short_name: "DI";
2453
    ident: DefaultIgnorableCodePoint;
2454
    data_marker: crate::provider::PropertyBinaryDefaultIgnorableCodePointV1;
2455
    singleton: SINGLETON_PROPERTY_BINARY_DEFAULT_IGNORABLE_CODE_POINT_V1;
2456
    /// For programmatic determination of default ignorable code points.
2457
    ///
2458
    /// New characters that
2459
    /// should be ignored in rendering (unless explicitly supported) will be assigned in these
2460
    /// ranges, permitting programs to correctly handle the default rendering of such
2461
    /// characters when not otherwise supported.
2462
    ///
2463
    /// # Example
2464
    ///
2465
    /// ```
2466
    /// use icu::properties::CodePointSetData;
2467
    /// use icu::properties::props::DefaultIgnorableCodePoint;
2468
    ///
2469
    /// let default_ignorable_code_point = CodePointSetData::new::<DefaultIgnorableCodePoint>();
2470
    ///
2471
    /// assert!(default_ignorable_code_point.contains('\u{180B}'));  // MONGOLIAN FREE VARIATION SELECTOR ONE
2472
    /// assert!(!default_ignorable_code_point.contains('E'));
2473
    /// ```
2474
2475
}
2476
2477
make_binary_property! {
2478
    name: "Diacritic";
2479
    short_name: "Dia";
2480
    ident: Diacritic;
2481
    data_marker: crate::provider::PropertyBinaryDiacriticV1;
2482
    singleton: SINGLETON_PROPERTY_BINARY_DIACRITIC_V1;
2483
    /// Characters that linguistically modify the meaning of another character to which they apply.
2484
    ///
2485
    /// # Example
2486
    ///
2487
    /// ```
2488
    /// use icu::properties::CodePointSetData;
2489
    /// use icu::properties::props::Diacritic;
2490
    ///
2491
    /// let diacritic = CodePointSetData::new::<Diacritic>();
2492
    ///
2493
    /// assert!(diacritic.contains('\u{05B3}'));  // HEBREW POINT HATAF QAMATS
2494
    /// assert!(!diacritic.contains('א'));  // U+05D0 HEBREW LETTER ALEF
2495
    /// ```
2496
2497
}
2498
2499
make_binary_property! {
2500
    name: "Emoji_Modifier_Base";
2501
    short_name: "EBase";
2502
    ident: EmojiModifierBase;
2503
    data_marker: crate::provider::PropertyBinaryEmojiModifierBaseV1;
2504
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_MODIFIER_BASE_V1;
2505
    /// Characters that can serve as a base for emoji modifiers.
2506
    ///
2507
    /// # Example
2508
    ///
2509
    /// ```
2510
    /// use icu::properties::CodePointSetData;
2511
    /// use icu::properties::props::EmojiModifierBase;
2512
    ///
2513
    /// let emoji_modifier_base = CodePointSetData::new::<EmojiModifierBase>();
2514
    ///
2515
    /// assert!(emoji_modifier_base.contains('✊'));  // U+270A RAISED FIST
2516
    /// assert!(!emoji_modifier_base.contains('⛰'));  // U+26F0 MOUNTAIN
2517
    /// ```
2518
2519
}
2520
2521
make_binary_property! {
2522
    name: "Emoji_Component";
2523
    short_name: "EComp";
2524
    ident: EmojiComponent;
2525
    data_marker: crate::provider::PropertyBinaryEmojiComponentV1;
2526
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_COMPONENT_V1;
2527
    /// Characters used in emoji sequences that normally do not appear on emoji keyboards as
2528
    /// separate choices, such as base characters for emoji keycaps.
2529
    ///
2530
    /// # Example
2531
    ///
2532
    /// ```
2533
    /// use icu::properties::CodePointSetData;
2534
    /// use icu::properties::props::EmojiComponent;
2535
    ///
2536
    /// let emoji_component = CodePointSetData::new::<EmojiComponent>();
2537
    ///
2538
    /// assert!(emoji_component.contains('🇹'));  // U+1F1F9 REGIONAL INDICATOR SYMBOL LETTER T
2539
    /// assert!(emoji_component.contains('\u{20E3}'));  // COMBINING ENCLOSING KEYCAP
2540
    /// assert!(emoji_component.contains('7'));
2541
    /// assert!(!emoji_component.contains('T'));
2542
    /// ```
2543
2544
}
2545
2546
make_binary_property! {
2547
    name: "Emoji_Modifier";
2548
    short_name: "EMod";
2549
    ident: EmojiModifier;
2550
    data_marker: crate::provider::PropertyBinaryEmojiModifierV1;
2551
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_MODIFIER_V1;
2552
    /// Characters that are emoji modifiers.
2553
    ///
2554
    /// # Example
2555
    ///
2556
    /// ```
2557
    /// use icu::properties::CodePointSetData;
2558
    /// use icu::properties::props::EmojiModifier;
2559
    ///
2560
    /// let emoji_modifier = CodePointSetData::new::<EmojiModifier>();
2561
    ///
2562
    /// assert!(emoji_modifier.contains('\u{1F3FD}'));  // EMOJI MODIFIER FITZPATRICK TYPE-4
2563
    /// assert!(!emoji_modifier.contains('\u{200C}'));  // ZERO WIDTH NON-JOINER
2564
    /// ```
2565
2566
}
2567
2568
make_binary_property! {
2569
    name: "Emoji";
2570
    short_name: "Emoji";
2571
    ident: Emoji;
2572
    data_marker: crate::provider::PropertyBinaryEmojiV1;
2573
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_V1;
2574
    /// Characters that are emoji.
2575
    ///
2576
    /// # Example
2577
    ///
2578
    /// ```
2579
    /// use icu::properties::CodePointSetData;
2580
    /// use icu::properties::props::Emoji;
2581
    ///
2582
    /// let emoji = CodePointSetData::new::<Emoji>();
2583
    ///
2584
    /// assert!(emoji.contains('🔥'));  // U+1F525 FIRE
2585
    /// assert!(!emoji.contains('V'));
2586
    /// ```
2587
2588
}
2589
2590
make_binary_property! {
2591
    name: "Emoji_Presentation";
2592
    short_name: "EPres";
2593
    ident: EmojiPresentation;
2594
    data_marker: crate::provider::PropertyBinaryEmojiPresentationV1;
2595
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_PRESENTATION_V1;
2596
    /// Characters that have emoji presentation by default.
2597
    ///
2598
    /// # Example
2599
    ///
2600
    /// ```
2601
    /// use icu::properties::CodePointSetData;
2602
    /// use icu::properties::props::EmojiPresentation;
2603
    ///
2604
    /// let emoji_presentation = CodePointSetData::new::<EmojiPresentation>();
2605
    ///
2606
    /// assert!(emoji_presentation.contains('🦬')); // U+1F9AC BISON
2607
    /// assert!(!emoji_presentation.contains('♻'));  // U+267B BLACK UNIVERSAL RECYCLING SYMBOL
2608
    /// ```
2609
2610
}
2611
2612
make_binary_property! {
2613
    name: "Extender";
2614
    short_name: "Ext";
2615
    ident: Extender;
2616
    data_marker: crate::provider::PropertyBinaryExtenderV1;
2617
    singleton: SINGLETON_PROPERTY_BINARY_EXTENDER_V1;
2618
    /// Characters whose principal function is to extend the value of a preceding alphabetic
2619
    /// character or to extend the shape of adjacent characters.
2620
    ///
2621
    /// # Example
2622
    ///
2623
    /// ```
2624
    /// use icu::properties::CodePointSetData;
2625
    /// use icu::properties::props::Extender;
2626
    ///
2627
    /// let extender = CodePointSetData::new::<Extender>();
2628
    ///
2629
    /// assert!(extender.contains('ヾ'));  // U+30FE KATAKANA VOICED ITERATION MARK
2630
    /// assert!(extender.contains('ー'));  // U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK
2631
    /// assert!(!extender.contains('・'));  // U+30FB KATAKANA MIDDLE DOT
2632
    /// ```
2633
2634
}
2635
2636
make_binary_property! {
2637
    name: "Extended_Pictographic";
2638
    short_name: "ExtPict";
2639
    ident: ExtendedPictographic;
2640
    data_marker: crate::provider::PropertyBinaryExtendedPictographicV1;
2641
    singleton: SINGLETON_PROPERTY_BINARY_EXTENDED_PICTOGRAPHIC_V1;
2642
    /// Pictographic symbols, as well as reserved ranges in blocks largely associated with
2643
    /// emoji characters
2644
    ///
2645
    /// # Example
2646
    ///
2647
    /// ```
2648
    /// use icu::properties::CodePointSetData;
2649
    /// use icu::properties::props::ExtendedPictographic;
2650
    ///
2651
    /// let extended_pictographic = CodePointSetData::new::<ExtendedPictographic>();
2652
    ///
2653
    /// assert!(extended_pictographic.contains('🥳')); // U+1F973 FACE WITH PARTY HORN AND PARTY HAT
2654
    /// assert!(!extended_pictographic.contains('🇪'));  // U+1F1EA REGIONAL INDICATOR SYMBOL LETTER E
2655
    /// ```
2656
2657
}
2658
2659
make_binary_property! {
2660
    name: "graph";
2661
    short_name: "graph";
2662
    ident: Graph;
2663
    data_marker: crate::provider::PropertyBinaryGraphV1;
2664
    singleton: SINGLETON_PROPERTY_BINARY_GRAPH_V1;
2665
    /// Invisible characters.
2666
    ///
2667
    /// This is defined for POSIX compatibility.
2668
2669
}
2670
2671
make_binary_property! {
2672
    name: "Grapheme_Base";
2673
    short_name: "Gr_Base";
2674
    ident: GraphemeBase;
2675
    data_marker: crate::provider::PropertyBinaryGraphemeBaseV1;
2676
    singleton: SINGLETON_PROPERTY_BINARY_GRAPHEME_BASE_V1;
2677
    /// Property used together with the definition of Standard Korean Syllable Block to define
2678
    /// "Grapheme base".
2679
    ///
2680
    /// See D58 in Chapter 3, Conformance in the Unicode Standard.
2681
    ///
2682
    /// # Example
2683
    ///
2684
    /// ```
2685
    /// use icu::properties::CodePointSetData;
2686
    /// use icu::properties::props::GraphemeBase;
2687
    ///
2688
    /// let grapheme_base = CodePointSetData::new::<GraphemeBase>();
2689
    ///
2690
    /// assert!(grapheme_base.contains('ക'));  // U+0D15 MALAYALAM LETTER KA
2691
    /// assert!(grapheme_base.contains('\u{0D3F}'));  // U+0D3F MALAYALAM VOWEL SIGN I
2692
    /// assert!(!grapheme_base.contains('\u{0D3E}'));  // U+0D3E MALAYALAM VOWEL SIGN AA
2693
    /// ```
2694
2695
}
2696
2697
make_binary_property! {
2698
    name: "Grapheme_Extend";
2699
    short_name: "Gr_Ext";
2700
    ident: GraphemeExtend;
2701
    data_marker: crate::provider::PropertyBinaryGraphemeExtendV1;
2702
    singleton: SINGLETON_PROPERTY_BINARY_GRAPHEME_EXTEND_V1;
2703
    /// Property used to define "Grapheme extender".
2704
    ///
2705
    /// See D59 in Chapter 3, Conformance in the
2706
    /// Unicode Standard.
2707
    ///
2708
    /// # Example
2709
    ///
2710
    /// ```
2711
    /// use icu::properties::CodePointSetData;
2712
    /// use icu::properties::props::GraphemeExtend;
2713
    ///
2714
    /// let grapheme_extend = CodePointSetData::new::<GraphemeExtend>();
2715
    ///
2716
    /// assert!(!grapheme_extend.contains('ക'));  // U+0D15 MALAYALAM LETTER KA
2717
    /// assert!(!grapheme_extend.contains('\u{0D3F}'));  // U+0D3F MALAYALAM VOWEL SIGN I
2718
    /// assert!(grapheme_extend.contains('\u{0D3E}'));  // U+0D3E MALAYALAM VOWEL SIGN AA
2719
    /// ```
2720
2721
}
2722
2723
make_binary_property! {
2724
    name: "Grapheme_Link";
2725
    short_name: "Gr_Link";
2726
    ident: GraphemeLink;
2727
    data_marker: crate::provider::PropertyBinaryGraphemeLinkV1;
2728
    singleton: SINGLETON_PROPERTY_BINARY_GRAPHEME_LINK_V1;
2729
    /// Deprecated property.
2730
    ///
2731
    /// Formerly proposed for programmatic determination of grapheme
2732
    /// cluster boundaries.
2733
}
2734
2735
make_binary_property! {
2736
    name: "Hex_Digit";
2737
    short_name: "Hex";
2738
    ident: HexDigit;
2739
    data_marker: crate::provider::PropertyBinaryHexDigitV1;
2740
    singleton: SINGLETON_PROPERTY_BINARY_HEX_DIGIT_V1;
2741
    /// Characters commonly used for the representation of hexadecimal numbers, plus their
2742
    /// compatibility equivalents.
2743
    ///
2744
    /// # Example
2745
    ///
2746
    /// ```
2747
    /// use icu::properties::CodePointSetData;
2748
    /// use icu::properties::props::HexDigit;
2749
    ///
2750
    /// let hex_digit = CodePointSetData::new::<HexDigit>();
2751
    ///
2752
    /// assert!(hex_digit.contains('0'));
2753
    /// assert!(!hex_digit.contains('੩'));  // U+0A69 GURMUKHI DIGIT THREE
2754
    /// assert!(hex_digit.contains('f'));
2755
    /// assert!(hex_digit.contains('f'));  // U+FF46 FULLWIDTH LATIN SMALL LETTER F
2756
    /// assert!(hex_digit.contains('F'));  // U+FF26 FULLWIDTH LATIN CAPITAL LETTER F
2757
    /// assert!(!hex_digit.contains('Ä'));  // U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
2758
    /// ```
2759
}
2760
2761
make_binary_property! {
2762
    name: "Hyphen";
2763
    short_name: "Hyphen";
2764
    ident: Hyphen;
2765
    data_marker: crate::provider::PropertyBinaryHyphenV1;
2766
    singleton: SINGLETON_PROPERTY_BINARY_HYPHEN_V1;
2767
    /// Deprecated property.
2768
    ///
2769
    /// Dashes which are used to mark connections between pieces of
2770
    /// words, plus the Katakana middle dot.
2771
}
2772
2773
make_binary_property! {
2774
    name: "ID_Compat_Math_Continue";
2775
    short_name: "ID_Compat_Math_Continue";
2776
    ident: IdCompatMathContinue;
2777
    data_marker: crate::provider::PropertyBinaryIdCompatMathContinueV1;
2778
    singleton: SINGLETON_PROPERTY_BINARY_ID_COMPAT_MATH_CONTINUE_V1;
2779
    /// `ID_Compat_Math_Continue` Property
2780
}
2781
2782
make_binary_property! {
2783
    name: "ID_Compat_Math_Start";
2784
    short_name: "ID_Compat_Math_Start";
2785
    ident: IdCompatMathStart;
2786
    data_marker: crate::provider::PropertyBinaryIdCompatMathStartV1;
2787
    singleton: SINGLETON_PROPERTY_BINARY_ID_COMPAT_MATH_START_V1;
2788
    /// `ID_Compat_Math_Start` Property
2789
}
2790
2791
make_binary_property! {
2792
    name: "ID_Continue";
2793
    short_name: "IDC";
2794
    ident: IdContinue;
2795
    data_marker: crate::provider::PropertyBinaryIdContinueV1;
2796
    singleton: SINGLETON_PROPERTY_BINARY_ID_CONTINUE_V1;
2797
    /// Characters that can come after the first character in an identifier.
2798
    ///
2799
    /// If using NFKC to
2800
    /// fold differences between characters, use [`XidContinue`] instead.  See
2801
    /// [`Unicode Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for
2802
    /// more details.
2803
    ///
2804
    /// # Example
2805
    ///
2806
    /// ```
2807
    /// use icu::properties::CodePointSetData;
2808
    /// use icu::properties::props::IdContinue;
2809
    ///
2810
    /// let id_continue = CodePointSetData::new::<IdContinue>();
2811
    ///
2812
    /// assert!(id_continue.contains('x'));
2813
    /// assert!(id_continue.contains('1'));
2814
    /// assert!(id_continue.contains('_'));
2815
    /// assert!(id_continue.contains('ߝ'));  // U+07DD NKO LETTER FA
2816
    /// assert!(!id_continue.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
2817
    /// assert!(id_continue.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
2818
    /// ```
2819
}
2820
2821
make_binary_property! {
2822
    name: "Ideographic";
2823
    short_name: "Ideo";
2824
    ident: Ideographic;
2825
    data_marker: crate::provider::PropertyBinaryIdeographicV1;
2826
    singleton: SINGLETON_PROPERTY_BINARY_IDEOGRAPHIC_V1;
2827
    /// Characters considered to be CJKV (Chinese, Japanese, Korean, and Vietnamese)
2828
    /// ideographs, or related siniform ideographs
2829
    ///
2830
    /// # Example
2831
    ///
2832
    /// ```
2833
    /// use icu::properties::CodePointSetData;
2834
    /// use icu::properties::props::Ideographic;
2835
    ///
2836
    /// let ideographic = CodePointSetData::new::<Ideographic>();
2837
    ///
2838
    /// assert!(ideographic.contains('川'));  // U+5DDD CJK UNIFIED IDEOGRAPH-5DDD
2839
    /// assert!(!ideographic.contains('밥'));  // U+BC25 HANGUL SYLLABLE BAB
2840
    /// ```
2841
}
2842
2843
make_binary_property! {
2844
    name: "ID_Start";
2845
    short_name: "IDS";
2846
    ident: IdStart;
2847
    data_marker: crate::provider::PropertyBinaryIdStartV1;
2848
    singleton: SINGLETON_PROPERTY_BINARY_ID_START_V1;
2849
    /// Characters that can begin an identifier.
2850
    ///
2851
    /// If using NFKC to fold differences between
2852
    /// characters, use [`XidStart`] instead.  See [`Unicode Standard Annex
2853
    /// #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more details.
2854
    ///
2855
    /// # Example
2856
    ///
2857
    /// ```
2858
    /// use icu::properties::CodePointSetData;
2859
    /// use icu::properties::props::IdStart;
2860
    ///
2861
    /// let id_start = CodePointSetData::new::<IdStart>();
2862
    ///
2863
    /// assert!(id_start.contains('x'));
2864
    /// assert!(!id_start.contains('1'));
2865
    /// assert!(!id_start.contains('_'));
2866
    /// assert!(id_start.contains('ߝ'));  // U+07DD NKO LETTER FA
2867
    /// assert!(!id_start.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
2868
    /// assert!(id_start.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
2869
    /// ```
2870
}
2871
2872
make_binary_property! {
2873
    name: "IDS_Binary_Operator";
2874
    short_name: "IDSB";
2875
    ident: IdsBinaryOperator;
2876
    data_marker: crate::provider::PropertyBinaryIdsBinaryOperatorV1;
2877
    singleton: SINGLETON_PROPERTY_BINARY_IDS_BINARY_OPERATOR_V1;
2878
    /// Characters used in Ideographic Description Sequences.
2879
    ///
2880
    /// # Example
2881
    ///
2882
    /// ```
2883
    /// use icu::properties::CodePointSetData;
2884
    /// use icu::properties::props::IdsBinaryOperator;
2885
    ///
2886
    /// let ids_binary_operator = CodePointSetData::new::<IdsBinaryOperator>();
2887
    ///
2888
    /// assert!(ids_binary_operator.contains('\u{2FF5}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE
2889
    /// assert!(!ids_binary_operator.contains('\u{3006}'));  // IDEOGRAPHIC CLOSING MARK
2890
    /// ```
2891
}
2892
2893
make_binary_property! {
2894
    name: "IDS_Trinary_Operator";
2895
    short_name: "IDST";
2896
    ident: IdsTrinaryOperator;
2897
    data_marker: crate::provider::PropertyBinaryIdsTrinaryOperatorV1;
2898
    singleton: SINGLETON_PROPERTY_BINARY_IDS_TRINARY_OPERATOR_V1;
2899
    /// Characters used in Ideographic Description Sequences.
2900
    ///
2901
    /// # Example
2902
    ///
2903
    /// ```
2904
    /// use icu::properties::CodePointSetData;
2905
    /// use icu::properties::props::IdsTrinaryOperator;
2906
    ///
2907
    /// let ids_trinary_operator = CodePointSetData::new::<IdsTrinaryOperator>();
2908
    ///
2909
    /// assert!(ids_trinary_operator.contains('\u{2FF2}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO MIDDLE AND RIGHT
2910
    /// assert!(ids_trinary_operator.contains('\u{2FF3}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO MIDDLE AND BELOW
2911
    /// assert!(!ids_trinary_operator.contains('\u{2FF4}'));
2912
    /// assert!(!ids_trinary_operator.contains('\u{2FF5}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE
2913
    /// assert!(!ids_trinary_operator.contains('\u{3006}'));  // IDEOGRAPHIC CLOSING MARK
2914
    /// ```
2915
}
2916
2917
make_binary_property! {
2918
    name: "IDS_Unary_Operator";
2919
    short_name: "IDSU";
2920
    ident: IdsUnaryOperator;
2921
    data_marker: crate::provider::PropertyBinaryIdsUnaryOperatorV1;
2922
    singleton: SINGLETON_PROPERTY_BINARY_IDS_UNARY_OPERATOR_V1;
2923
    /// `IDS_Unary_Operator` Property
2924
}
2925
2926
make_binary_property! {
2927
    name: "Join_Control";
2928
    short_name: "Join_C";
2929
    ident: JoinControl;
2930
    data_marker: crate::provider::PropertyBinaryJoinControlV1;
2931
    singleton: SINGLETON_PROPERTY_BINARY_JOIN_CONTROL_V1;
2932
    /// Format control characters which have specific functions for control of cursive joining
2933
    /// and ligation.
2934
    ///
2935
    /// # Example
2936
    ///
2937
    /// ```
2938
    /// use icu::properties::CodePointSetData;
2939
    /// use icu::properties::props::JoinControl;
2940
    ///
2941
    /// let join_control = CodePointSetData::new::<JoinControl>();
2942
    ///
2943
    /// assert!(join_control.contains('\u{200C}'));  // ZERO WIDTH NON-JOINER
2944
    /// assert!(join_control.contains('\u{200D}'));  // ZERO WIDTH JOINER
2945
    /// assert!(!join_control.contains('\u{200E}'));
2946
    /// ```
2947
}
2948
2949
make_binary_property! {
2950
    name: "Logical_Order_Exception";
2951
    short_name: "LOE";
2952
    ident: LogicalOrderException;
2953
    data_marker: crate::provider::PropertyBinaryLogicalOrderExceptionV1;
2954
    singleton: SINGLETON_PROPERTY_BINARY_LOGICAL_ORDER_EXCEPTION_V1;
2955
    /// A small number of spacing vowel letters occurring in certain Southeast Asian scripts such as Thai and Lao.
2956
    ///
2957
    /// # Example
2958
    ///
2959
    /// ```
2960
    /// use icu::properties::CodePointSetData;
2961
    /// use icu::properties::props::LogicalOrderException;
2962
    ///
2963
    /// let logical_order_exception = CodePointSetData::new::<LogicalOrderException>();
2964
    ///
2965
    /// assert!(logical_order_exception.contains('ແ'));  // U+0EC1 LAO VOWEL SIGN EI
2966
    /// assert!(!logical_order_exception.contains('ະ'));  // U+0EB0 LAO VOWEL SIGN A
2967
    /// ```
2968
}
2969
2970
make_binary_property! {
2971
    name: "Lowercase";
2972
    short_name: "Lower";
2973
    ident: Lowercase;
2974
    data_marker: crate::provider::PropertyBinaryLowercaseV1;
2975
    singleton: SINGLETON_PROPERTY_BINARY_LOWERCASE_V1;
2976
    /// Lowercase characters.
2977
    ///
2978
    /// # Example
2979
    ///
2980
    /// ```
2981
    /// use icu::properties::CodePointSetData;
2982
    /// use icu::properties::props::Lowercase;
2983
    ///
2984
    /// let lowercase = CodePointSetData::new::<Lowercase>();
2985
    ///
2986
    /// assert!(lowercase.contains('a'));
2987
    /// assert!(!lowercase.contains('A'));
2988
    /// ```
2989
}
2990
2991
make_binary_property! {
2992
    name: "Math";
2993
    short_name: "Math";
2994
    ident: Math;
2995
    data_marker: crate::provider::PropertyBinaryMathV1;
2996
    singleton: SINGLETON_PROPERTY_BINARY_MATH_V1;
2997
    /// Characters used in mathematical notation.
2998
    ///
2999
    /// # Example
3000
    ///
3001
    /// ```
3002
    /// use icu::properties::CodePointSetData;
3003
    /// use icu::properties::props::Math;
3004
    ///
3005
    /// let math = CodePointSetData::new::<Math>();
3006
    ///
3007
    /// assert!(math.contains('='));
3008
    /// assert!(math.contains('+'));
3009
    /// assert!(!math.contains('-'));
3010
    /// assert!(math.contains('−'));  // U+2212 MINUS SIGN
3011
    /// assert!(!math.contains('/'));
3012
    /// assert!(math.contains('∕'));  // U+2215 DIVISION SLASH
3013
    /// ```
3014
}
3015
3016
make_binary_property! {
3017
    name: "Modifier_Combining_Mark";
3018
    short_name: "MCM";
3019
    ident: ModifierCombiningMark;
3020
    data_marker: crate::provider::PropertyBinaryModifierCombiningMarkV1;
3021
    singleton: SINGLETON_PROPERTY_BINARY_MODIFIER_COMBINING_MARK_V1;
3022
    /// `Modifier_Combining_Mark` Property
3023
}
3024
3025
make_binary_property! {
3026
    name: "Noncharacter_Code_Point";
3027
    short_name: "NChar";
3028
    ident: NoncharacterCodePoint;
3029
    data_marker: crate::provider::PropertyBinaryNoncharacterCodePointV1;
3030
    singleton: SINGLETON_PROPERTY_BINARY_NONCHARACTER_CODE_POINT_V1;
3031
    /// Code points permanently reserved for internal use.
3032
    ///
3033
    /// # Example
3034
    ///
3035
    /// ```
3036
    /// use icu::properties::CodePointSetData;
3037
    /// use icu::properties::props::NoncharacterCodePoint;
3038
    ///
3039
    /// let noncharacter_code_point = CodePointSetData::new::<NoncharacterCodePoint>();
3040
    ///
3041
    /// assert!(noncharacter_code_point.contains('\u{FDD0}'));
3042
    /// assert!(noncharacter_code_point.contains('\u{FFFF}'));
3043
    /// assert!(!noncharacter_code_point.contains('\u{10000}'));
3044
    /// ```
3045
}
3046
3047
make_binary_property! {
3048
    name: "NFC_Inert";
3049
    short_name: "nfcinert";
3050
    ident: NfcInert;
3051
    data_marker: crate::provider::PropertyBinaryNfcInertV1;
3052
    singleton: SINGLETON_PROPERTY_BINARY_NFC_INERT_V1;
3053
    /// Characters that are inert under NFC, i.e., they do not interact with adjacent characters.
3054
}
3055
3056
make_binary_property! {
3057
    name: "NFD_Inert";
3058
    short_name: "nfdinert";
3059
    ident: NfdInert;
3060
    data_marker: crate::provider::PropertyBinaryNfdInertV1;
3061
    singleton: SINGLETON_PROPERTY_BINARY_NFD_INERT_V1;
3062
    /// Characters that are inert under NFD, i.e., they do not interact with adjacent characters.
3063
}
3064
3065
make_binary_property! {
3066
    name: "NFKC_Inert";
3067
    short_name: "nfkcinert";
3068
    ident: NfkcInert;
3069
    data_marker: crate::provider::PropertyBinaryNfkcInertV1;
3070
    singleton: SINGLETON_PROPERTY_BINARY_NFKC_INERT_V1;
3071
    /// Characters that are inert under NFKC, i.e., they do not interact with adjacent characters.
3072
}
3073
3074
make_binary_property! {
3075
    name: "NFKD_Inert";
3076
    short_name: "nfkdinert";
3077
    ident: NfkdInert;
3078
    data_marker: crate::provider::PropertyBinaryNfkdInertV1;
3079
    singleton: SINGLETON_PROPERTY_BINARY_NFKD_INERT_V1;
3080
    /// Characters that are inert under NFKD, i.e., they do not interact with adjacent characters.
3081
}
3082
3083
make_binary_property! {
3084
    name: "Pattern_Syntax";
3085
    short_name: "Pat_Syn";
3086
    ident: PatternSyntax;
3087
    data_marker: crate::provider::PropertyBinaryPatternSyntaxV1;
3088
    singleton: SINGLETON_PROPERTY_BINARY_PATTERN_SYNTAX_V1;
3089
    /// Characters used as syntax in patterns (such as regular expressions).
3090
    ///
3091
    /// See [`Unicode
3092
    /// Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more
3093
    /// details.
3094
    ///
3095
    /// # Example
3096
    ///
3097
    /// ```
3098
    /// use icu::properties::CodePointSetData;
3099
    /// use icu::properties::props::PatternSyntax;
3100
    ///
3101
    /// let pattern_syntax = CodePointSetData::new::<PatternSyntax>();
3102
    ///
3103
    /// assert!(pattern_syntax.contains('{'));
3104
    /// assert!(pattern_syntax.contains('⇒'));  // U+21D2 RIGHTWARDS DOUBLE ARROW
3105
    /// assert!(!pattern_syntax.contains('0'));
3106
    /// ```
3107
}
3108
3109
make_binary_property! {
3110
    name: "Pattern_White_Space";
3111
    short_name: "Pat_WS";
3112
    ident: PatternWhiteSpace;
3113
    data_marker: crate::provider::PropertyBinaryPatternWhiteSpaceV1;
3114
    singleton: SINGLETON_PROPERTY_BINARY_PATTERN_WHITE_SPACE_V1;
3115
    /// Characters used as whitespace in patterns (such as regular expressions).
3116
    ///
3117
    /// See
3118
    /// [`Unicode Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for
3119
    /// more details.
3120
    ///
3121
    /// # Example
3122
    ///
3123
    /// ```
3124
    /// use icu::properties::CodePointSetData;
3125
    /// use icu::properties::props::PatternWhiteSpace;
3126
    ///
3127
    /// let pattern_white_space = CodePointSetData::new::<PatternWhiteSpace>();
3128
    ///
3129
    /// assert!(pattern_white_space.contains(' '));
3130
    /// assert!(pattern_white_space.contains('\u{2029}'));  // PARAGRAPH SEPARATOR
3131
    /// assert!(pattern_white_space.contains('\u{000A}'));  // NEW LINE
3132
    /// assert!(!pattern_white_space.contains('\u{00A0}'));  // NO-BREAK SPACE
3133
    /// ```
3134
}
3135
3136
make_binary_property! {
3137
    name: "Prepended_Concatenation_Mark";
3138
    short_name: "PCM";
3139
    ident: PrependedConcatenationMark;
3140
    data_marker: crate::provider::PropertyBinaryPrependedConcatenationMarkV1;
3141
    singleton: SINGLETON_PROPERTY_BINARY_PREPENDED_CONCATENATION_MARK_V1;
3142
    /// A small class of visible format controls, which precede and then span a sequence of
3143
    /// other characters, usually digits.
3144
}
3145
3146
make_binary_property! {
3147
    name: "print";
3148
    short_name: "print";
3149
    ident: Print;
3150
    data_marker: crate::provider::PropertyBinaryPrintV1;
3151
    singleton: SINGLETON_PROPERTY_BINARY_PRINT_V1;
3152
    /// Printable characters (visible characters and whitespace).
3153
    ///
3154
    /// This is defined for POSIX compatibility.
3155
}
3156
3157
make_binary_property! {
3158
    name: "Quotation_Mark";
3159
    short_name: "QMark";
3160
    ident: QuotationMark;
3161
    data_marker: crate::provider::PropertyBinaryQuotationMarkV1;
3162
    singleton: SINGLETON_PROPERTY_BINARY_QUOTATION_MARK_V1;
3163
    /// Punctuation characters that function as quotation marks.
3164
    ///
3165
    /// # Example
3166
    ///
3167
    /// ```
3168
    /// use icu::properties::CodePointSetData;
3169
    /// use icu::properties::props::QuotationMark;
3170
    ///
3171
    /// let quotation_mark = CodePointSetData::new::<QuotationMark>();
3172
    ///
3173
    /// assert!(quotation_mark.contains('\''));
3174
    /// assert!(quotation_mark.contains('„'));  // U+201E DOUBLE LOW-9 QUOTATION MARK
3175
    /// assert!(!quotation_mark.contains('<'));
3176
    /// ```
3177
}
3178
3179
make_binary_property! {
3180
    name: "Radical";
3181
    short_name: "Radical";
3182
    ident: Radical;
3183
    data_marker: crate::provider::PropertyBinaryRadicalV1;
3184
    singleton: SINGLETON_PROPERTY_BINARY_RADICAL_V1;
3185
    /// Characters used in the definition of Ideographic Description Sequences.
3186
    ///
3187
    /// # Example
3188
    ///
3189
    /// ```
3190
    /// use icu::properties::CodePointSetData;
3191
    /// use icu::properties::props::Radical;
3192
    ///
3193
    /// let radical = CodePointSetData::new::<Radical>();
3194
    ///
3195
    /// assert!(radical.contains('⺆'));  // U+2E86 CJK RADICAL BOX
3196
    /// assert!(!radical.contains('丹'));  // U+F95E CJK COMPATIBILITY IDEOGRAPH-F95E
3197
    /// ```
3198
}
3199
3200
make_binary_property! {
3201
    name: "Regional_Indicator";
3202
    short_name: "RI";
3203
    ident: RegionalIndicator;
3204
    data_marker: crate::provider::PropertyBinaryRegionalIndicatorV1;
3205
    singleton: SINGLETON_PROPERTY_BINARY_REGIONAL_INDICATOR_V1;
3206
    /// Regional indicator characters, `U+1F1E6..U+1F1FF`.
3207
    ///
3208
    /// # Example
3209
    ///
3210
    /// ```
3211
    /// use icu::properties::CodePointSetData;
3212
    /// use icu::properties::props::RegionalIndicator;
3213
    ///
3214
    /// let regional_indicator = CodePointSetData::new::<RegionalIndicator>();
3215
    ///
3216
    /// assert!(regional_indicator.contains('🇹'));  // U+1F1F9 REGIONAL INDICATOR SYMBOL LETTER T
3217
    /// assert!(!regional_indicator.contains('Ⓣ'));  // U+24C9 CIRCLED LATIN CAPITAL LETTER T
3218
    /// assert!(!regional_indicator.contains('T'));
3219
    /// ```
3220
}
3221
3222
make_binary_property! {
3223
    name: "Soft_Dotted";
3224
    short_name: "SD";
3225
    ident: SoftDotted;
3226
    data_marker: crate::provider::PropertyBinarySoftDottedV1;
3227
    singleton: SINGLETON_PROPERTY_BINARY_SOFT_DOTTED_V1;
3228
    /// Characters with a "soft dot", like i or j.
3229
    ///
3230
    /// An accent placed on these characters causes
3231
    /// the dot to disappear.
3232
    ///
3233
    /// # Example
3234
    ///
3235
    /// ```
3236
    /// use icu::properties::CodePointSetData;
3237
    /// use icu::properties::props::SoftDotted;
3238
    ///
3239
    /// let soft_dotted = CodePointSetData::new::<SoftDotted>();
3240
    ///
3241
    /// assert!(soft_dotted.contains('і'));  //U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
3242
    /// assert!(!soft_dotted.contains('ı'));  // U+0131 LATIN SMALL LETTER DOTLESS I
3243
    /// ```
3244
}
3245
3246
make_binary_property! {
3247
    name: "Segment_Starter";
3248
    short_name: "segstart";
3249
    ident: SegmentStarter;
3250
    data_marker: crate::provider::PropertyBinarySegmentStarterV1;
3251
    singleton: SINGLETON_PROPERTY_BINARY_SEGMENT_STARTER_V1;
3252
    /// Characters that are starters in terms of Unicode normalization and combining character
3253
    /// sequences.
3254
}
3255
3256
make_binary_property! {
3257
    name: "Case_Sensitive";
3258
    short_name: "Sensitive";
3259
    ident: CaseSensitive;
3260
    data_marker: crate::provider::PropertyBinaryCaseSensitiveV1;
3261
    singleton: SINGLETON_PROPERTY_BINARY_CASE_SENSITIVE_V1;
3262
    /// Characters that are either the source of a case mapping or in the target of a case
3263
    /// mapping.
3264
}
3265
3266
make_binary_property! {
3267
    name: "Sentence_Terminal";
3268
    short_name: "STerm";
3269
    ident: SentenceTerminal;
3270
    data_marker: crate::provider::PropertyBinarySentenceTerminalV1;
3271
    singleton: SINGLETON_PROPERTY_BINARY_SENTENCE_TERMINAL_V1;
3272
    /// Punctuation characters that generally mark the end of sentences.
3273
    ///
3274
    /// # Example
3275
    ///
3276
    /// ```
3277
    /// use icu::properties::CodePointSetData;
3278
    /// use icu::properties::props::SentenceTerminal;
3279
    ///
3280
    /// let sentence_terminal = CodePointSetData::new::<SentenceTerminal>();
3281
    ///
3282
    /// assert!(sentence_terminal.contains('.'));
3283
    /// assert!(sentence_terminal.contains('?'));
3284
    /// assert!(sentence_terminal.contains('᪨'));  // U+1AA8 TAI THAM SIGN KAAN
3285
    /// assert!(!sentence_terminal.contains(','));
3286
    /// assert!(!sentence_terminal.contains('¿'));  // U+00BF INVERTED QUESTION MARK
3287
    /// ```
3288
}
3289
3290
make_binary_property! {
3291
    name: "Terminal_Punctuation";
3292
    short_name: "Term";
3293
    ident: TerminalPunctuation;
3294
    data_marker: crate::provider::PropertyBinaryTerminalPunctuationV1;
3295
    singleton: SINGLETON_PROPERTY_BINARY_TERMINAL_PUNCTUATION_V1;
3296
    /// Punctuation characters that generally mark the end of textual units.
3297
    ///
3298
    /// # Example
3299
    ///
3300
    /// ```
3301
    /// use icu::properties::CodePointSetData;
3302
    /// use icu::properties::props::TerminalPunctuation;
3303
    ///
3304
    /// let terminal_punctuation = CodePointSetData::new::<TerminalPunctuation>();
3305
    ///
3306
    /// assert!(terminal_punctuation.contains('.'));
3307
    /// assert!(terminal_punctuation.contains('?'));
3308
    /// assert!(terminal_punctuation.contains('᪨'));  // U+1AA8 TAI THAM SIGN KAAN
3309
    /// assert!(terminal_punctuation.contains(','));
3310
    /// assert!(!terminal_punctuation.contains('¿'));  // U+00BF INVERTED QUESTION MARK
3311
    /// ```
3312
}
3313
3314
make_binary_property! {
3315
    name: "Unified_Ideograph";
3316
    short_name: "UIdeo";
3317
    ident: UnifiedIdeograph;
3318
    data_marker: crate::provider::PropertyBinaryUnifiedIdeographV1;
3319
    singleton: SINGLETON_PROPERTY_BINARY_UNIFIED_IDEOGRAPH_V1;
3320
    /// A property which specifies the exact set of Unified CJK Ideographs in the standard.
3321
    ///
3322
    /// # Example
3323
    ///
3324
    /// ```
3325
    /// use icu::properties::CodePointSetData;
3326
    /// use icu::properties::props::UnifiedIdeograph;
3327
    ///
3328
    /// let unified_ideograph = CodePointSetData::new::<UnifiedIdeograph>();
3329
    ///
3330
    /// assert!(unified_ideograph.contains('川'));  // U+5DDD CJK UNIFIED IDEOGRAPH-5DDD
3331
    /// assert!(unified_ideograph.contains('木'));  // U+6728 CJK UNIFIED IDEOGRAPH-6728
3332
    /// assert!(!unified_ideograph.contains('𛅸'));  // U+1B178 NUSHU CHARACTER-1B178
3333
    /// ```
3334
}
3335
3336
make_binary_property! {
3337
    name: "Uppercase";
3338
    short_name: "Upper";
3339
    ident: Uppercase;
3340
    data_marker: crate::provider::PropertyBinaryUppercaseV1;
3341
    singleton: SINGLETON_PROPERTY_BINARY_UPPERCASE_V1;
3342
    /// Uppercase characters.
3343
    ///
3344
    /// # Example
3345
    ///
3346
    /// ```
3347
    /// use icu::properties::CodePointSetData;
3348
    /// use icu::properties::props::Uppercase;
3349
    ///
3350
    /// let uppercase = CodePointSetData::new::<Uppercase>();
3351
    ///
3352
    /// assert!(uppercase.contains('U'));
3353
    /// assert!(!uppercase.contains('u'));
3354
    /// ```
3355
}
3356
3357
make_binary_property! {
3358
    name: "Variation_Selector";
3359
    short_name: "VS";
3360
    ident: VariationSelector;
3361
    data_marker: crate::provider::PropertyBinaryVariationSelectorV1;
3362
    singleton: SINGLETON_PROPERTY_BINARY_VARIATION_SELECTOR_V1;
3363
    /// Characters that are Variation Selectors.
3364
    ///
3365
    /// # Example
3366
    ///
3367
    /// ```
3368
    /// use icu::properties::CodePointSetData;
3369
    /// use icu::properties::props::VariationSelector;
3370
    ///
3371
    /// let variation_selector = CodePointSetData::new::<VariationSelector>();
3372
    ///
3373
    /// assert!(variation_selector.contains('\u{180D}'));  // MONGOLIAN FREE VARIATION SELECTOR THREE
3374
    /// assert!(!variation_selector.contains('\u{303E}'));  // IDEOGRAPHIC VARIATION INDICATOR
3375
    /// assert!(variation_selector.contains('\u{FE0F}'));  // VARIATION SELECTOR-16
3376
    /// assert!(!variation_selector.contains('\u{FE10}'));  // PRESENTATION FORM FOR VERTICAL COMMA
3377
    /// assert!(variation_selector.contains('\u{E01EF}'));  // VARIATION SELECTOR-256
3378
    /// ```
3379
}
3380
3381
make_binary_property! {
3382
    name: "White_Space";
3383
    short_name: "WSpace";
3384
    ident: WhiteSpace;
3385
    data_marker: crate::provider::PropertyBinaryWhiteSpaceV1;
3386
    singleton: SINGLETON_PROPERTY_BINARY_WHITE_SPACE_V1;
3387
    /// Spaces, separator characters and other control characters which should be treated by
3388
    /// programming languages as "white space" for the purpose of parsing elements.
3389
    ///
3390
    /// # Example
3391
    ///
3392
    /// ```
3393
    /// use icu::properties::CodePointSetData;
3394
    /// use icu::properties::props::WhiteSpace;
3395
    ///
3396
    /// let white_space = CodePointSetData::new::<WhiteSpace>();
3397
    ///
3398
    /// assert!(white_space.contains(' '));
3399
    /// assert!(white_space.contains('\u{000A}'));  // NEW LINE
3400
    /// assert!(white_space.contains('\u{00A0}'));  // NO-BREAK SPACE
3401
    /// assert!(!white_space.contains('\u{200B}'));  // ZERO WIDTH SPACE
3402
    /// ```
3403
}
3404
3405
make_binary_property! {
3406
    name: "xdigit";
3407
    short_name: "xdigit";
3408
    ident: Xdigit;
3409
    data_marker: crate::provider::PropertyBinaryXdigitV1;
3410
    singleton: SINGLETON_PROPERTY_BINARY_XDIGIT_V1;
3411
    /// Hexadecimal digits
3412
    ///
3413
    /// This is defined for POSIX compatibility.
3414
}
3415
3416
make_binary_property! {
3417
    name: "XID_Continue";
3418
    short_name: "XIDC";
3419
    ident: XidContinue;
3420
    data_marker: crate::provider::PropertyBinaryXidContinueV1;
3421
    singleton: SINGLETON_PROPERTY_BINARY_XID_CONTINUE_V1;
3422
    /// Characters that can come after the first character in an identifier.
3423
    ///
3424
    /// See [`Unicode Standard Annex
3425
    /// #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more details.
3426
    ///
3427
    /// # Example
3428
    ///
3429
    /// ```
3430
    /// use icu::properties::CodePointSetData;
3431
    /// use icu::properties::props::XidContinue;
3432
    ///
3433
    /// let xid_continue = CodePointSetData::new::<XidContinue>();
3434
    ///
3435
    /// assert!(xid_continue.contains('x'));
3436
    /// assert!(xid_continue.contains('1'));
3437
    /// assert!(xid_continue.contains('_'));
3438
    /// assert!(xid_continue.contains('ߝ'));  // U+07DD NKO LETTER FA
3439
    /// assert!(!xid_continue.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
3440
    /// assert!(!xid_continue.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
3441
    /// ```
3442
}
3443
3444
make_binary_property! {
3445
    name: "XID_Start";
3446
    short_name: "XIDS";
3447
    ident: XidStart;
3448
    data_marker: crate::provider::PropertyBinaryXidStartV1;
3449
    singleton: SINGLETON_PROPERTY_BINARY_XID_START_V1;
3450
    /// Characters that can begin an identifier.
3451
    ///
3452
    /// See [`Unicode
3453
    /// Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more
3454
    /// details.
3455
    ///
3456
    /// # Example
3457
    ///
3458
    /// ```
3459
    /// use icu::properties::CodePointSetData;
3460
    /// use icu::properties::props::XidStart;
3461
    ///
3462
    /// let xid_start = CodePointSetData::new::<XidStart>();
3463
    ///
3464
    /// assert!(xid_start.contains('x'));
3465
    /// assert!(!xid_start.contains('1'));
3466
    /// assert!(!xid_start.contains('_'));
3467
    /// assert!(xid_start.contains('ߝ'));  // U+07DD NKO LETTER FA
3468
    /// assert!(!xid_start.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
3469
    /// assert!(!xid_start.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
3470
    /// ```
3471
}
3472
3473
pub use crate::emoji::EmojiSet;
3474
3475
macro_rules! make_emoji_set {
3476
    (
3477
        name: $name:literal;
3478
        short_name: $short_name:literal;
3479
        ident: $ident:ident;
3480
        data_marker: $data_marker:ty;
3481
        singleton: $singleton:ident;
3482
        $(#[$doc:meta])+
3483
    ) => {
3484
        $(#[$doc])+
3485
        #[derive(Debug)]
3486
        #[non_exhaustive]
3487
        pub struct $ident;
3488
3489
        impl crate::private::Sealed for $ident {}
3490
3491
        impl EmojiSet for $ident {
3492
            type DataMarker = $data_marker;
3493
            #[cfg(feature = "compiled_data")]
3494
            const SINGLETON: &'static crate::provider::PropertyUnicodeSet<'static> =
3495
                &crate::provider::Baked::$singleton;
3496
            const NAME: &'static [u8] = $name.as_bytes();
3497
            const SHORT_NAME: &'static [u8] = $short_name.as_bytes();
3498
        }
3499
    }
3500
}
3501
3502
make_emoji_set! {
3503
    name: "Basic_Emoji";
3504
    short_name: "Basic_Emoji";
3505
    ident: BasicEmoji;
3506
    data_marker: crate::provider::PropertyBinaryBasicEmojiV1;
3507
    singleton: SINGLETON_PROPERTY_BINARY_BASIC_EMOJI_V1;
3508
    /// Characters and character sequences intended for general-purpose, independent, direct input.
3509
    ///
3510
    /// See [`Unicode Technical Standard #51`](https://unicode.org/reports/tr51/) for more
3511
    /// details.
3512
    ///
3513
    /// # Example
3514
    ///
3515
    /// ```
3516
    /// use icu::properties::EmojiSetData;
3517
    /// use icu::properties::props::BasicEmoji;
3518
    ///
3519
    /// let basic_emoji = EmojiSetData::new::<BasicEmoji>();
3520
    ///
3521
    /// assert!(!basic_emoji.contains('\u{0020}'));
3522
    /// assert!(!basic_emoji.contains('\n'));
3523
    /// assert!(basic_emoji.contains('🦃')); // U+1F983 TURKEY
3524
    /// assert!(basic_emoji.contains_str("\u{1F983}"));
3525
    /// assert!(basic_emoji.contains_str("\u{1F6E4}\u{FE0F}")); // railway track
3526
    /// assert!(!basic_emoji.contains_str("\u{0033}\u{FE0F}\u{20E3}"));  // Emoji_Keycap_Sequence, keycap 3
3527
    /// ```
3528
}
3529
3530
#[cfg(test)]
3531
mod test_enumerated_property_completeness {
3532
    use super::*;
3533
    use std::collections::BTreeMap;
3534
3535
    fn check_enum<'a, T: NamedEnumeratedProperty>(
3536
        lookup: &crate::provider::names::PropertyValueNameToEnumMap<'static>,
3537
        consts: impl IntoIterator<Item = &'a T>,
3538
    ) where
3539
        u16: From<T>,
3540
    {
3541
        let mut data: BTreeMap<_, _> = lookup
3542
            .map
3543
            .iter()
3544
            .map(|(name, value)| (value, (name, "Data")))
3545
            .collect();
3546
3547
        let names = crate::PropertyNamesLong::<T>::new();
3548
        let consts = consts.into_iter().map(|value| {
3549
            (
3550
                u16::from(*value) as usize,
3551
                (
3552
                    names.get(*value).unwrap_or("<unknown>").to_string(),
3553
                    "Consts",
3554
                ),
3555
            )
3556
        });
3557
3558
        let mut diff = Vec::new();
3559
        for t @ (value, _) in consts {
3560
            if data.remove(&value).is_none() {
3561
                diff.push(t);
3562
            }
3563
        }
3564
        diff.extend(data);
3565
3566
        let mut fmt_diff = String::new();
3567
        for (value, (name, source)) in diff {
3568
            fmt_diff.push_str(&format!("{source}:\t{name} = {value:?}\n"));
3569
        }
3570
3571
        assert!(
3572
            fmt_diff.is_empty(),
3573
            "Values defined in data do not match values defined in consts. Difference:\n{fmt_diff}"
3574
        );
3575
    }
3576
3577
    #[test]
3578
    fn test_ea() {
3579
        check_enum(
3580
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_EAST_ASIAN_WIDTH_V1,
3581
            EastAsianWidth::ALL_VALUES,
3582
        );
3583
    }
3584
3585
    #[test]
3586
    fn test_ccc() {
3587
        check_enum(
3588
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_CANONICAL_COMBINING_CLASS_V1,
3589
            CanonicalCombiningClass::ALL_VALUES,
3590
        );
3591
    }
3592
3593
    #[test]
3594
    fn test_jt() {
3595
        check_enum(
3596
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_JOINING_TYPE_V1,
3597
            JoiningType::ALL_VALUES,
3598
        );
3599
    }
3600
3601
    #[test]
3602
    fn test_insc() {
3603
        check_enum(
3604
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_INDIC_SYLLABIC_CATEGORY_V1,
3605
            IndicSyllabicCategory::ALL_VALUES,
3606
        );
3607
    }
3608
3609
    #[test]
3610
    fn test_sb() {
3611
        check_enum(
3612
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_SENTENCE_BREAK_V1,
3613
            SentenceBreak::ALL_VALUES,
3614
        );
3615
    }
3616
3617
    #[test]
3618
    fn test_wb() {
3619
        check_enum(
3620
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_WORD_BREAK_V1,
3621
            WordBreak::ALL_VALUES,
3622
        );
3623
    }
3624
3625
    #[test]
3626
    fn test_bc() {
3627
        check_enum(
3628
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_BIDI_CLASS_V1,
3629
            BidiClass::ALL_VALUES,
3630
        );
3631
    }
3632
3633
    #[test]
3634
    fn test_nt() {
3635
        check_enum(
3636
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_NUMERIC_TYPE_V1,
3637
            NumericType::ALL_VALUES,
3638
        );
3639
    }
3640
3641
    #[test]
3642
    fn test_hst() {
3643
        check_enum(
3644
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_HANGUL_SYLLABLE_TYPE_V1,
3645
            HangulSyllableType::ALL_VALUES,
3646
        );
3647
    }
3648
3649
    #[test]
3650
    fn test_vo() {
3651
        check_enum(
3652
            crate::provider::Baked::SINGLETON_PROPERTY_NAME_PARSE_VERTICAL_ORIENTATION_V1,
3653
            VerticalOrientation::ALL_VALUES,
3654
        );
3655
    }
3656
}