Coverage Report

Created: 2026-10-17 07:26

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/icu_properties-2.3.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
pub use crate::code_point_map::EnumeratedProperty;
24
25
macro_rules! make_enumerated_property {
26
    (
27
        name: $name:literal;
28
        short_name: $short_name:literal;
29
        ident: $value_ty:path;
30
        data_marker: $data_marker:ty;
31
        singleton: $singleton:ident;
32
        $(ule_ty: $ule_ty:ty;)?
33
    ) => {
34
        impl crate::private::Sealed for $value_ty {}
35
36
        impl EnumeratedProperty for $value_ty {
37
            type DataMarker = $data_marker;
38
            #[cfg(feature = "compiled_data")]
39
            const SINGLETON: &'static crate::provider::PropertyCodePointMap<'static, Self> =
40
                crate::provider::Baked::$singleton;
41
            const NAME: &'static [u8] = $name.as_bytes();
42
            const SHORT_NAME: &'static [u8] = $short_name.as_bytes();
43
        }
44
45
        $(
46
            impl zerovec::ule::AsULE for $value_ty {
47
                type ULE = $ule_ty;
48
49
0
                fn to_unaligned(self) -> Self::ULE {
50
0
                    self.0.to_unaligned()
51
0
                }
Unexecuted instantiation: <icu_properties::props::HangulSyllableType as zerovec::ule::AsULE>::to_unaligned
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::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::JoiningType as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::VerticalOrientation as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::IndicSyllabicCategory as zerovec::ule::AsULE>::to_unaligned
Unexecuted instantiation: <icu_properties::props::JoiningGroup 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
52
0
                fn from_unaligned(unaligned: Self::ULE) -> Self {
53
0
                    Self(zerovec::ule::AsULE::from_unaligned(unaligned))
54
0
                }
Unexecuted instantiation: <icu_properties::props::HangulSyllableType as zerovec::ule::AsULE>::from_unaligned
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::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::JoiningType as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::VerticalOrientation as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::IndicSyllabicCategory as zerovec::ule::AsULE>::from_unaligned
Unexecuted instantiation: <icu_properties::props::JoiningGroup 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
55
            }
56
        )?
57
    };
58
}
59
60
/// Enumerated property `Bidi_Class`
61
///
62
/// These are the categories required by the Unicode Bidirectional Algorithm.
63
/// For the property values, see [Bidirectional Class Values](https://unicode.org/reports/tr44/#Bidi_Class_Values).
64
/// For more information, see [Unicode Standard Annex #9](https://unicode.org/reports/tr41/tr41-28.html#UAX9).
65
///
66
/// # Example
67
///
68
/// ```
69
/// use icu::properties::{CodePointMapData, props::BidiClass};
70
///
71
/// assert_eq!(
72
///     CodePointMapData::<BidiClass>::new().get('y'),
73
///     BidiClass::LeftToRight
74
/// ); // U+0079
75
/// assert_eq!(
76
///     CodePointMapData::<BidiClass>::new().get('ع'),
77
///     BidiClass::ArabicLetter
78
/// ); // U+0639
79
/// ```
80
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
81
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
82
#[allow(clippy::exhaustive_structs)] // newtype
83
#[repr(transparent)]
84
pub struct BidiClass(pub(crate) u8);
85
86
impl BidiClass {
87
    /// Returns an ICU4C `UBidiClass` value.
88
    #[deprecated(
89
        since = "2.3.0",
90
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
91
    )]
92
0
    pub const fn to_icu4c_value(self) -> u8 {
93
0
        self.0
94
0
    }
95
    /// Constructor from an ICU4C `UBidiClass` value.
96
    #[deprecated(
97
        since = "2.3.0",
98
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
99
    )]
100
0
    pub const fn from_icu4c_value(value: u8) -> Self {
101
0
        Self(value)
102
0
    }
103
}
104
105
impl Default for BidiClass {
106
0
    fn default() -> Self {
107
0
        Self::LeftToRight
108
0
    }
109
}
110
111
make_enumerated_property! {
112
    name: "Bidi_Class";
113
    short_name: "bc";
114
    ident: BidiClass;
115
    data_marker: crate::provider::PropertyEnumBidiClassV1;
116
    singleton: SINGLETON_PROPERTY_ENUM_BIDI_CLASS_V1;
117
    ule_ty: u8;
118
}
119
120
/// Enumerated property `Numeric_Type`.
121
///
122
/// See Section 4.6, Numeric Value in The Unicode Standard for the summary of
123
/// each property value.
124
///
125
/// # Example
126
///
127
/// ```
128
/// use icu::properties::{CodePointMapData, props::NumericType};
129
///
130
/// assert_eq!(
131
///     CodePointMapData::<NumericType>::new().get('0'),
132
///     NumericType::Decimal,
133
/// ); // U+0030
134
/// assert_eq!(
135
///     CodePointMapData::<NumericType>::new().get('½'),
136
///     NumericType::Numeric,
137
/// ); // U+00BD
138
/// ```
139
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
140
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
141
#[allow(clippy::exhaustive_structs)] // newtype
142
#[repr(transparent)]
143
pub struct NumericType(pub(crate) u8);
144
145
impl NumericType {
146
    /// Returns an ICU4C `UNumericType` value.
147
    #[deprecated(
148
        since = "2.3.0",
149
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
150
    )]
151
0
    pub const fn to_icu4c_value(self) -> u8 {
152
0
        self.0
153
0
    }
154
    /// Constructor from an ICU4C `UNumericType` value.
155
    #[deprecated(
156
        since = "2.3.0",
157
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
158
    )]
159
0
    pub const fn from_icu4c_value(value: u8) -> Self {
160
0
        Self(value)
161
0
    }
162
}
163
164
impl Default for NumericType {
165
0
    fn default() -> Self {
166
0
        Self::None
167
0
    }
168
}
169
170
make_enumerated_property! {
171
    name: "Numeric_Type";
172
    short_name: "nt";
173
    ident: NumericType;
174
    data_marker: crate::provider::PropertyEnumNumericTypeV1;
175
    singleton: SINGLETON_PROPERTY_ENUM_NUMERIC_TYPE_V1;
176
    ule_ty: u8;
177
}
178
179
/// Enumerated property `General_Category`.
180
///
181
/// `General_Category` specifies the most general classification of a code point, usually
182
/// determined based on the primary characteristic of the assigned character. For example, is the
183
/// character a letter, a mark, a number, punctuation, or a symbol, and if so, of what type?
184
///
185
/// `GeneralCategory` only supports specific subcategories (eg `UppercaseLetter`).
186
/// It does not support grouped categories (eg `Letter`). For grouped categories, use [`GeneralCategoryGroup`].
187
///
188
/// # Example
189
///
190
/// ```
191
/// use icu::properties::{CodePointMapData, props::GeneralCategory};
192
///
193
/// assert_eq!(
194
///     CodePointMapData::<GeneralCategory>::new().get('木'),
195
///     GeneralCategory::OtherLetter
196
/// ); // U+6728
197
/// assert_eq!(
198
///     CodePointMapData::<GeneralCategory>::new().get('🎃'),
199
///     GeneralCategory::OtherSymbol
200
/// ); // U+1F383 JACK-O-LANTERN
201
/// ```
202
pub use crate::enum_values::GeneralCategory;
203
204
#[allow(clippy::derivable_impls)] // declaration is codegen'd
205
impl Default for GeneralCategory {
206
0
    fn default() -> Self {
207
0
        Self::Unassigned
208
0
    }
209
}
210
211
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash, Default)]
212
/// Error value for `impl TryFrom<u8> for GeneralCategory`.
213
#[non_exhaustive]
214
pub struct GeneralCategoryOutOfBoundsError;
215
216
impl TryFrom<u8> for GeneralCategory {
217
    type Error = GeneralCategoryOutOfBoundsError;
218
    /// Construct this [`GeneralCategory`] from an integer, returning
219
    /// an error if it is out of bounds
220
0
    fn try_from(val: u8) -> Result<Self, GeneralCategoryOutOfBoundsError> {
221
0
        GeneralCategory::new_from_u8(val).ok_or(GeneralCategoryOutOfBoundsError)
222
0
    }
223
}
224
225
make_enumerated_property! {
226
    name: "General_Category";
227
    short_name: "gc";
228
    ident: GeneralCategory;
229
    data_marker: crate::provider::PropertyEnumGeneralCategoryV1;
230
    singleton: SINGLETON_PROPERTY_ENUM_GENERAL_CATEGORY_V1;
231
}
232
233
/// Groupings of multiple `General_Category` property values.
234
///
235
/// Instances of `GeneralCategoryGroup` represent the defined multi-category
236
/// values that are useful for users in certain contexts, such as regex. In
237
/// other words, unlike [`GeneralCategory`], this supports groups of general
238
/// categories: for example, `Letter` /// is the union of `UppercaseLetter`,
239
/// `LowercaseLetter`, etc.
240
///
241
/// See <https://www.unicode.org/reports/tr44/> .
242
///
243
/// The discriminants correspond to the `U_GC_XX_MASK` constants in ICU4C.
244
/// Unlike [`GeneralCategory`], this supports groups of general categories: for example, `Letter`
245
/// is the union of `UppercaseLetter`, `LowercaseLetter`, etc.
246
///
247
/// See `UCharCategory` and `U_GET_GC_MASK` in ICU4C.
248
#[derive(Copy, Clone, PartialEq, Debug, Eq)]
249
#[allow(clippy::exhaustive_structs)] // newtype
250
#[repr(transparent)]
251
pub struct GeneralCategoryGroup(pub(crate) u32);
252
253
impl crate::private::Sealed for GeneralCategoryGroup {}
254
255
use GeneralCategory as GC;
256
use GeneralCategoryGroup as GCG;
257
258
#[allow(non_upper_case_globals, missing_docs)]
259
impl GeneralCategoryGroup {
260
    /// An uppercase letter
261
    pub const UppercaseLetter: GeneralCategoryGroup = GCG(1 << (GC::UppercaseLetter as u32));
262
    pub const Lu: GeneralCategoryGroup = Self::UppercaseLetter;
263
    /// A lowercase letter
264
    pub const Ll: Self = Self::LowercaseLetter;
265
    pub const LowercaseLetter: GeneralCategoryGroup = GCG(1 << (GC::LowercaseLetter as u32));
266
    /// A digraphic letter, with first part uppercase
267
    pub const TitlecaseLetter: GeneralCategoryGroup = GCG(1 << (GC::TitlecaseLetter as u32));
268
    pub const Lt: Self = Self::TitlecaseLetter;
269
    /// A modifier letter
270
    pub const ModifierLetter: GeneralCategoryGroup = GCG(1 << (GC::ModifierLetter as u32));
271
    pub const Lm: Self = Self::ModifierLetter;
272
    /// Other letters, including syllables and ideographs
273
    pub const OtherLetter: GeneralCategoryGroup = GCG(1 << (GC::OtherLetter as u32));
274
    pub const Lo: Self = Self::OtherLetter;
275
    /// The union of `UppercaseLetter`, `LowercaseLetter`, and `TitlecaseLetter`
276
    pub const CasedLetter: GeneralCategoryGroup = GCG((1 << (GC::UppercaseLetter as u32))
277
        | (1 << (GC::LowercaseLetter as u32))
278
        | (1 << (GC::TitlecaseLetter as u32)));
279
    pub const LC: Self = Self::CasedLetter;
280
    /// The union of all letter categories
281
    pub const Letter: GeneralCategoryGroup = GCG((1 << (GC::UppercaseLetter as u32))
282
        | (1 << (GC::LowercaseLetter as u32))
283
        | (1 << (GC::TitlecaseLetter as u32))
284
        | (1 << (GC::ModifierLetter as u32))
285
        | (1 << (GC::OtherLetter as u32)));
286
    pub const L: Self = Self::Letter;
287
288
    /// A nonspacing combining mark (zero advance width)
289
    pub const NonspacingMark: GeneralCategoryGroup = GCG(1 << (GC::NonspacingMark as u32));
290
    pub const Mn: Self = Self::NonspacingMark;
291
    /// An enclosing combining mark
292
    pub const EnclosingMark: GeneralCategoryGroup = GCG(1 << (GC::EnclosingMark as u32));
293
    pub const Me: Self = Self::EnclosingMark;
294
    /// A spacing combining mark (positive advance width)
295
    pub const SpacingMark: GeneralCategoryGroup = GCG(1 << (GC::SpacingMark as u32));
296
    pub const Mc: Self = Self::SpacingMark;
297
    /// The union of all mark categories
298
    pub const Mark: GeneralCategoryGroup = GCG((1 << (GC::NonspacingMark as u32))
299
        | (1 << (GC::EnclosingMark as u32))
300
        | (1 << (GC::SpacingMark as u32)));
301
    pub const M: Self = Self::Mark;
302
303
    /// A decimal digit
304
    pub const DecimalNumber: GeneralCategoryGroup = GCG(1 << (GC::DecimalNumber as u32));
305
    pub const Nd: Self = Self::DecimalNumber;
306
    /// A letterlike numeric character
307
    pub const LetterNumber: GeneralCategoryGroup = GCG(1 << (GC::LetterNumber as u32));
308
    pub const Nl: Self = Self::LetterNumber;
309
    /// A numeric character of other type
310
    pub const OtherNumber: GeneralCategoryGroup = GCG(1 << (GC::OtherNumber as u32));
311
    pub const No: Self = Self::OtherNumber;
312
    /// The union of all number categories
313
    pub const Number: GeneralCategoryGroup = GCG((1 << (GC::DecimalNumber as u32))
314
        | (1 << (GC::LetterNumber as u32))
315
        | (1 << (GC::OtherNumber as u32)));
316
    pub const N: Self = Self::Number;
317
318
    /// A space character (of various non-zero widths)
319
    pub const SpaceSeparator: GeneralCategoryGroup = GCG(1 << (GC::SpaceSeparator as u32));
320
    pub const Zs: Self = Self::SpaceSeparator;
321
    /// U+2028 LINE SEPARATOR only
322
    pub const LineSeparator: GeneralCategoryGroup = GCG(1 << (GC::LineSeparator as u32));
323
    pub const Zl: Self = Self::LineSeparator;
324
    /// U+2029 PARAGRAPH SEPARATOR only
325
    pub const ParagraphSeparator: GeneralCategoryGroup = GCG(1 << (GC::ParagraphSeparator as u32));
326
    pub const Zp: Self = Self::ParagraphSeparator;
327
    /// The union of all separator categories
328
    pub const Separator: GeneralCategoryGroup = GCG((1 << (GC::SpaceSeparator as u32))
329
        | (1 << (GC::LineSeparator as u32))
330
        | (1 << (GC::ParagraphSeparator as u32)));
331
    pub const Z: Self = Self::Separator;
332
333
    /// A C0 or C1 control code
334
    pub const Control: GeneralCategoryGroup = GCG(1 << (GC::Control as u32));
335
    pub const Cc: Self = Self::Control;
336
    /// A format control character
337
    pub const Format: GeneralCategoryGroup = GCG(1 << (GC::Format as u32));
338
    pub const Cf: Self = Self::Format;
339
    /// A private-use character
340
    pub const PrivateUse: GeneralCategoryGroup = GCG(1 << (GC::PrivateUse as u32));
341
    pub const Co: Self = Self::PrivateUse;
342
    /// A surrogate code point
343
    pub const Surrogate: GeneralCategoryGroup = GCG(1 << (GC::Surrogate as u32));
344
    pub const Cs: Self = Self::Surrogate;
345
    /// A reserved unassigned code point or a noncharacter
346
    pub const Unassigned: GeneralCategoryGroup = GCG(1 << (GC::Unassigned as u32));
347
    pub const Cn: Self = Self::Unassigned;
348
    /// The union of all control code, reserved, and unassigned categories
349
    pub const Other: GeneralCategoryGroup = GCG((1 << (GC::Control as u32))
350
        | (1 << (GC::Format as u32))
351
        | (1 << (GC::PrivateUse as u32))
352
        | (1 << (GC::Surrogate as u32))
353
        | (1 << (GC::Unassigned as u32)));
354
    pub const C: Self = Self::Other;
355
356
    /// A dash or hyphen punctuation mark
357
    pub const DashPunctuation: GeneralCategoryGroup = GCG(1 << (GC::DashPunctuation as u32));
358
    pub const Pd: Self = Self::DashPunctuation;
359
    /// An opening punctuation mark (of a pair)
360
    pub const OpenPunctuation: GeneralCategoryGroup = GCG(1 << (GC::OpenPunctuation as u32));
361
    pub const Ps: Self = Self::OpenPunctuation;
362
    /// A closing punctuation mark (of a pair)
363
    pub const ClosePunctuation: GeneralCategoryGroup = GCG(1 << (GC::ClosePunctuation as u32));
364
    pub const Pe: Self = Self::ClosePunctuation;
365
    /// A connecting punctuation mark, like a tie
366
    pub const ConnectorPunctuation: GeneralCategoryGroup =
367
        GCG(1 << (GC::ConnectorPunctuation as u32));
368
    pub const Pc: Self = Self::ConnectorPunctuation;
369
    /// An initial quotation mark
370
    pub const InitialPunctuation: GeneralCategoryGroup = GCG(1 << (GC::InitialPunctuation as u32));
371
    pub const Pi: Self = Self::InitialPunctuation;
372
    /// A final quotation mark
373
    pub const FinalPunctuation: GeneralCategoryGroup = GCG(1 << (GC::FinalPunctuation as u32));
374
    pub const Pf: Self = Self::FinalPunctuation;
375
    /// A punctuation mark of other type
376
    pub const OtherPunctuation: GeneralCategoryGroup = GCG(1 << (GC::OtherPunctuation as u32));
377
    pub const Po: Self = Self::OtherPunctuation;
378
    /// The union of all punctuation categories
379
    pub const Punctuation: GeneralCategoryGroup = GCG((1 << (GC::DashPunctuation as u32))
380
        | (1 << (GC::OpenPunctuation as u32))
381
        | (1 << (GC::ClosePunctuation as u32))
382
        | (1 << (GC::ConnectorPunctuation as u32))
383
        | (1 << (GC::OtherPunctuation as u32))
384
        | (1 << (GC::InitialPunctuation as u32))
385
        | (1 << (GC::FinalPunctuation as u32)));
386
    pub const P: Self = Self::Punctuation;
387
388
    /// A symbol of mathematical use
389
    pub const MathSymbol: GeneralCategoryGroup = GCG(1 << (GC::MathSymbol as u32));
390
    pub const Sm: Self = Self::MathSymbol;
391
    /// A currency sign
392
    pub const CurrencySymbol: GeneralCategoryGroup = GCG(1 << (GC::CurrencySymbol as u32));
393
    pub const Sc: Self = Self::CurrencySymbol;
394
    /// A non-letterlike modifier symbol
395
    pub const ModifierSymbol: GeneralCategoryGroup = GCG(1 << (GC::ModifierSymbol as u32));
396
    pub const Sk: Self = Self::ModifierSymbol;
397
    /// A symbol of other type
398
    pub const OtherSymbol: GeneralCategoryGroup = GCG(1 << (GC::OtherSymbol as u32));
399
    pub const So: Self = Self::OtherSymbol;
400
    /// The union of all symbol categories
401
    pub const Symbol: GeneralCategoryGroup = GCG((1 << (GC::MathSymbol as u32))
402
        | (1 << (GC::CurrencySymbol as u32))
403
        | (1 << (GC::ModifierSymbol as u32))
404
        | (1 << (GC::OtherSymbol as u32)));
405
    pub const S: Self = Self::Symbol;
406
407
    const ALL: u32 = (1 << (GC::FinalPunctuation as u32 + 1)) - 1;
408
409
    #[cfg(feature = "datagen")]
410
    #[doc(hidden)]
411
    pub fn names() -> impl Iterator<Item = (&'static str, Self)> {
412
        [
413
            ("Lu", Self::UppercaseLetter),
414
            ("Ll", Self::LowercaseLetter),
415
            ("Lt", Self::TitlecaseLetter),
416
            ("Lm", Self::ModifierLetter),
417
            ("Lo", Self::OtherLetter),
418
            ("LC", Self::CasedLetter),
419
            ("L", Self::Letter),
420
            ("Mn", Self::NonspacingMark),
421
            ("Me", Self::EnclosingMark),
422
            ("Mc", Self::SpacingMark),
423
            ("M", Self::Mark),
424
            ("Nd", Self::DecimalNumber),
425
            ("Nl", Self::LetterNumber),
426
            ("No", Self::OtherNumber),
427
            ("N", Self::Number),
428
            ("Zs", Self::SpaceSeparator),
429
            ("Zl", Self::LineSeparator),
430
            ("Zp", Self::ParagraphSeparator),
431
            ("Z", Self::Separator),
432
            ("Cc", Self::Control),
433
            ("Cf", Self::Format),
434
            ("Co", Self::PrivateUse),
435
            ("Cs", Self::Surrogate),
436
            ("Cn", Self::Unassigned),
437
            ("C", Self::Other),
438
            ("Pd", Self::DashPunctuation),
439
            ("Ps", Self::OpenPunctuation),
440
            ("Pe", Self::ClosePunctuation),
441
            ("Pc", Self::ConnectorPunctuation),
442
            ("Pi", Self::InitialPunctuation),
443
            ("Pf", Self::FinalPunctuation),
444
            ("Po", Self::OtherPunctuation),
445
            ("P", Self::Punctuation),
446
            ("Sm", Self::MathSymbol),
447
            ("Sc", Self::CurrencySymbol),
448
            ("Sk", Self::ModifierSymbol),
449
            ("So", Self::OtherSymbol),
450
            ("S", Self::Symbol),
451
        ]
452
        .into_iter()
453
    }
454
455
    /// Return whether the code point belongs in the provided multi-value category.
456
    ///
457
    /// ```
458
    /// use icu::properties::CodePointMapData;
459
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
460
    ///
461
    /// let gc = CodePointMapData::<GeneralCategory>::new();
462
    ///
463
    /// assert_eq!(gc.get('A'), GeneralCategory::UppercaseLetter);
464
    /// assert!(GeneralCategoryGroup::CasedLetter.contains(gc.get('A')));
465
    ///
466
    /// // U+0B1E ORIYA LETTER NYA
467
    /// assert_eq!(gc.get('ଞ'), GeneralCategory::OtherLetter);
468
    /// assert!(GeneralCategoryGroup::Letter.contains(gc.get('ଞ')));
469
    /// assert!(!GeneralCategoryGroup::CasedLetter.contains(gc.get('ଞ')));
470
    ///
471
    /// // U+0301 COMBINING ACUTE ACCENT
472
    /// assert_eq!(gc.get('\u{0301}'), GeneralCategory::NonspacingMark);
473
    /// assert!(GeneralCategoryGroup::Mark.contains(gc.get('\u{0301}')));
474
    /// assert!(!GeneralCategoryGroup::Letter.contains(gc.get('\u{0301}')));
475
    ///
476
    /// assert_eq!(gc.get('0'), GeneralCategory::DecimalNumber);
477
    /// assert!(GeneralCategoryGroup::Number.contains(gc.get('0')));
478
    /// assert!(!GeneralCategoryGroup::Mark.contains(gc.get('0')));
479
    ///
480
    /// assert_eq!(gc.get('('), GeneralCategory::OpenPunctuation);
481
    /// assert!(GeneralCategoryGroup::Punctuation.contains(gc.get('(')));
482
    /// assert!(!GeneralCategoryGroup::Number.contains(gc.get('(')));
483
    ///
484
    /// // U+2713 CHECK MARK
485
    /// assert_eq!(gc.get('✓'), GeneralCategory::OtherSymbol);
486
    /// assert!(GeneralCategoryGroup::Symbol.contains(gc.get('✓')));
487
    /// assert!(!GeneralCategoryGroup::Punctuation.contains(gc.get('✓')));
488
    ///
489
    /// assert_eq!(gc.get(' '), GeneralCategory::SpaceSeparator);
490
    /// assert!(GeneralCategoryGroup::Separator.contains(gc.get(' ')));
491
    /// assert!(!GeneralCategoryGroup::Symbol.contains(gc.get(' ')));
492
    ///
493
    /// // U+E007F CANCEL TAG
494
    /// assert_eq!(gc.get('\u{E007F}'), GeneralCategory::Format);
495
    /// assert!(GeneralCategoryGroup::Other.contains(gc.get('\u{E007F}')));
496
    /// assert!(!GeneralCategoryGroup::Separator.contains(gc.get('\u{E007F}')));
497
    /// ```
498
0
    pub const fn contains(self, val: GeneralCategory) -> bool {
499
0
        0 != (1 << (val as u32)) & self.0
500
0
    }
501
502
    /// Produce a `GeneralCategoryGroup` that is the inverse of this one
503
    ///
504
    /// # Example
505
    ///
506
    /// ```rust
507
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
508
    ///
509
    /// let letter = GeneralCategoryGroup::Letter;
510
    /// let not_letter = letter.complement();
511
    ///
512
    /// assert!(not_letter.contains(GeneralCategory::MathSymbol));
513
    /// assert!(!letter.contains(GeneralCategory::MathSymbol));
514
    /// assert!(not_letter.contains(GeneralCategory::OtherPunctuation));
515
    /// assert!(!letter.contains(GeneralCategory::OtherPunctuation));
516
    /// assert!(!not_letter.contains(GeneralCategory::UppercaseLetter));
517
    /// assert!(letter.contains(GeneralCategory::UppercaseLetter));
518
    /// ```
519
0
    pub const fn complement(self) -> Self {
520
        // Mask off things not in Self::ALL to guarantee the mask
521
        // values stay in-range
522
0
        GeneralCategoryGroup(!self.0 & Self::ALL)
523
0
    }
524
525
    /// Return the group representing all `GeneralCategory` values
526
    ///
527
    /// # Example
528
    ///
529
    /// ```rust
530
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
531
    ///
532
    /// let all = GeneralCategoryGroup::all();
533
    ///
534
    /// assert!(all.contains(GeneralCategory::MathSymbol));
535
    /// assert!(all.contains(GeneralCategory::OtherPunctuation));
536
    /// assert!(all.contains(GeneralCategory::UppercaseLetter));
537
    /// ```
538
0
    pub const fn all() -> Self {
539
0
        Self(Self::ALL)
540
0
    }
541
542
    /// Return the empty group
543
    ///
544
    /// # Example
545
    ///
546
    /// ```rust
547
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
548
    ///
549
    /// let empty = GeneralCategoryGroup::empty();
550
    ///
551
    /// assert!(!empty.contains(GeneralCategory::MathSymbol));
552
    /// assert!(!empty.contains(GeneralCategory::OtherPunctuation));
553
    /// assert!(!empty.contains(GeneralCategory::UppercaseLetter));
554
    /// ```
555
0
    pub const fn empty() -> Self {
556
0
        Self(0)
557
0
    }
558
559
    /// Take the union of two groups
560
    ///
561
    /// # Example
562
    ///
563
    /// ```rust
564
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
565
    ///
566
    /// let letter = GeneralCategoryGroup::Letter;
567
    /// let symbol = GeneralCategoryGroup::Symbol;
568
    /// let union = letter.union(symbol);
569
    ///
570
    /// assert!(union.contains(GeneralCategory::MathSymbol));
571
    /// assert!(!union.contains(GeneralCategory::OtherPunctuation));
572
    /// assert!(union.contains(GeneralCategory::UppercaseLetter));
573
    /// ```
574
0
    pub const fn union(self, other: Self) -> Self {
575
0
        Self(self.0 | other.0)
576
0
    }
577
578
    /// Take the intersection of two groups
579
    ///
580
    /// # Example
581
    ///
582
    /// ```rust
583
    /// use icu::properties::props::{GeneralCategory, GeneralCategoryGroup};
584
    ///
585
    /// let letter = GeneralCategoryGroup::Letter;
586
    /// let lu = GeneralCategoryGroup::UppercaseLetter;
587
    /// let intersection = letter.intersection(lu);
588
    ///
589
    /// assert!(!intersection.contains(GeneralCategory::MathSymbol));
590
    /// assert!(!intersection.contains(GeneralCategory::OtherPunctuation));
591
    /// assert!(intersection.contains(GeneralCategory::UppercaseLetter));
592
    /// assert!(!intersection.contains(GeneralCategory::LowercaseLetter));
593
    /// ```
594
0
    pub const fn intersection(self, other: Self) -> Self {
595
0
        Self(self.0 & other.0)
596
0
    }
597
}
598
599
impl From<GeneralCategory> for GeneralCategoryGroup {
600
0
    fn from(subcategory: GeneralCategory) -> Self {
601
0
        GeneralCategoryGroup(1 << (subcategory as u32))
602
0
    }
603
}
604
impl From<u32> for GeneralCategoryGroup {
605
0
    fn from(mask: u32) -> Self {
606
        // Mask off things not in Self::ALL to guarantee the mask
607
        // values stay in-range
608
0
        GeneralCategoryGroup(mask & Self::ALL)
609
0
    }
610
}
611
impl From<GeneralCategoryGroup> for u32 {
612
0
    fn from(group: GeneralCategoryGroup) -> Self {
613
0
        group.0
614
0
    }
615
}
616
617
/// Enumerated property Script.
618
///
619
/// This is used with both the Script and `Script_Extensions` Unicode properties.
620
/// Each character is assigned a single Script, but characters that are used in
621
/// a particular subset of scripts will be in more than one `Script_Extensions` set.
622
/// For example, `DEVANAGARI DIGIT NINE` has `Script=Devanagari`, but is also in the
623
/// `Script_Extensions` set for `Dogra`, `Kaithi`, and `Mahajani`. If you are trying to
624
/// determine whether a code point belongs to a certain script, you should use
625
/// [`ScriptWithExtensionsBorrowed::has_script`].
626
///
627
/// For more information, see UAX #24: <https://www.unicode.org/reports/tr24/>.
628
///
629
/// Additional constants are provided for ISO 15924 script codes, even if these are not encoded in
630
/// Unicode. For example, `Han` is a Unicode script (corresponding to the ISO 15924 code `Hani`),
631
/// but ISO 15924 also defines `Hans` and `Hant` for simplified and traditional Han.
632
///
633
/// Such constants are documented as non-Unicode constants, and are not returned as the `Script`
634
/// property for any code point.
635
///
636
/// # Example
637
///
638
/// ```
639
/// use icu::properties::{CodePointMapData, props::Script};
640
///
641
/// assert_eq!(CodePointMapData::<Script>::new().get('木'), Script::Han);  // U+6728
642
/// assert_eq!(CodePointMapData::<Script>::new().get('🎃'), Script::Common);  // U+1F383 JACK-O-LANTERN
643
/// ```
644
/// [`ScriptWithExtensionsBorrowed::has_script`]: crate::script::ScriptWithExtensionsBorrowed::has_script
645
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
646
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
647
#[allow(clippy::exhaustive_structs)] // newtype
648
#[repr(transparent)]
649
pub struct Script(pub(crate) u16);
650
651
impl Script {
652
    /// Returns an ICU4C `UScriptCode` value.
653
    #[deprecated(
654
        since = "2.3.0",
655
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
656
    )]
657
0
    pub const fn to_icu4c_value(self) -> u16 {
658
0
        self.0
659
0
    }
660
    /// Constructor from an ICU4C `UScriptCode` value.
661
    #[deprecated(
662
        since = "2.3.0",
663
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
664
    )]
665
0
    pub const fn from_icu4c_value(value: u16) -> Self {
666
0
        Self(value)
667
0
    }
668
    /// Deprecated: non-canonical spelling
669
    #[deprecated(since = "2.3.0", note = "use Script::Ethiopic instead")]
670
    #[allow(non_upper_case_globals)]
671
    pub const Ethiopian: Self = Self::Ethiopic;
672
    /// Deprecated: non-canonical spelling
673
    #[deprecated(since = "2.3.0", note = "use Script::ArabicNastaliq instead")]
674
    #[allow(non_upper_case_globals)]
675
    pub const Nastaliq: Self = Self::ArabicNastaliq;
676
}
677
678
impl Default for Script {
679
0
    fn default() -> Self {
680
0
        Self::Unknown
681
0
    }
682
}
683
684
impl Script {
685
    // Doesn't actually exist!
686
    #[doc(hidden)]
687
    #[allow(non_upper_case_globals)]
688
    #[deprecated]
689
    // Some high value that ICU4C will not use anytime soon
690
    pub const Chisoi: Script = Self(60_000);
691
}
692
693
/// ✨ *Enabled with the `compiled_data` Cargo feature.*
694
#[cfg(feature = "compiled_data")]
695
impl From<Script> for icu_locale_core::subtags::Script {
696
0
    fn from(value: Script) -> Self {
697
0
        crate::PropertyNamesShort::new()
698
0
            .get_locale_script(value)
699
0
            .unwrap_or(icu_locale_core::subtags::script!("Zzzz"))
700
0
    }
701
}
702
703
/// ✨ *Enabled with the `compiled_data` Cargo feature.*
704
#[cfg(feature = "compiled_data")]
705
impl From<icu_locale_core::subtags::Script> for Script {
706
0
    fn from(value: icu_locale_core::subtags::Script) -> Self {
707
0
        crate::PropertyParser::new()
708
0
            .get_strict(value.as_str())
709
0
            .unwrap_or(Self::Unknown)
710
0
    }
711
}
712
713
make_enumerated_property! {
714
    name: "Script";
715
    short_name: "sc";
716
    ident: Script;
717
    data_marker: crate::provider::PropertyEnumScriptV1;
718
    singleton: SINGLETON_PROPERTY_ENUM_SCRIPT_V1;
719
    ule_ty: <u16 as zerovec::ule::AsULE>::ULE;
720
}
721
722
/// Enumerated property `Hangul_Syllable_Type`
723
///
724
/// The Unicode standard provides both precomposed Hangul syllables and conjoining Jamo to compose
725
/// arbitrary Hangul syllables. This property provides that ontology of Hangul code points.
726
///
727
/// For more information, see the [Unicode Korean FAQ](https://www.unicode.org/faq/korean.html).
728
///
729
/// # Example
730
///
731
/// ```
732
/// use icu::properties::{CodePointMapData, props::HangulSyllableType};
733
///
734
/// assert_eq!(
735
///     CodePointMapData::<HangulSyllableType>::new().get('ᄀ'),
736
///     HangulSyllableType::LeadingJamo
737
/// ); // U+1100
738
/// assert_eq!(
739
///     CodePointMapData::<HangulSyllableType>::new().get('가'),
740
///     HangulSyllableType::LeadingVowelSyllable
741
/// ); // U+AC00
742
/// ```
743
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
744
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
745
#[allow(clippy::exhaustive_structs)] // newtype
746
#[repr(transparent)]
747
pub struct HangulSyllableType(pub(crate) u8);
748
749
impl HangulSyllableType {
750
    /// Returns an ICU4C `UHangulSyllableType` value.
751
    #[deprecated(
752
        since = "2.3.0",
753
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
754
    )]
755
0
    pub const fn to_icu4c_value(self) -> u8 {
756
0
        self.0
757
0
    }
758
    /// Constructor from an ICU4C `UHangulSyllableType` value.
759
    #[deprecated(
760
        since = "2.3.0",
761
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
762
    )]
763
0
    pub const fn from_icu4c_value(value: u8) -> Self {
764
0
        Self(value)
765
0
    }
766
    /// Deprecated: non-canonical spelling
767
    #[deprecated(since = "2.3.0", note = "use HangulSyllableType::LVSyllable instead")]
768
    #[allow(non_upper_case_globals)]
769
    pub const LeadingVowelSyllable: Self = Self::LVSyllable;
770
    /// Deprecated: non-canonical spelling
771
    #[deprecated(since = "2.3.0", note = "use HangulSyllableType::LVTSyllable instead")]
772
    #[allow(non_upper_case_globals)]
773
    pub const LeadingVowelTrailingSyllable: Self = Self::LVTSyllable;
774
}
775
776
impl Default for HangulSyllableType {
777
0
    fn default() -> Self {
778
0
        Self::NotApplicable
779
0
    }
780
}
781
782
make_enumerated_property! {
783
    name: "Hangul_Syllable_Type";
784
    short_name: "hst";
785
    ident: HangulSyllableType;
786
    data_marker: crate::provider::PropertyEnumHangulSyllableTypeV1;
787
    singleton: SINGLETON_PROPERTY_ENUM_HANGUL_SYLLABLE_TYPE_V1;
788
    ule_ty: u8;
789
790
}
791
792
/// Enumerated property `East_Asian_Width`.
793
///
794
/// See "Definition" in UAX #11 for the summary of each property value:
795
/// <https://www.unicode.org/reports/tr11/#Definitions>
796
///
797
/// # Example
798
///
799
/// ```
800
/// use icu::properties::{CodePointMapData, props::EastAsianWidth};
801
///
802
/// assert_eq!(
803
///     CodePointMapData::<EastAsianWidth>::new().get('ア'),
804
///     EastAsianWidth::Halfwidth
805
/// ); // U+FF71: Halfwidth Katakana Letter A
806
/// assert_eq!(
807
///     CodePointMapData::<EastAsianWidth>::new().get('ア'),
808
///     EastAsianWidth::Wide
809
/// ); //U+30A2: Katakana Letter A
810
/// ```
811
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
812
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
813
#[allow(clippy::exhaustive_structs)] // newtype
814
#[repr(transparent)]
815
pub struct EastAsianWidth(pub(crate) u8);
816
817
impl EastAsianWidth {
818
    /// Returns an ICU4C `UEastAsianWidth` value.
819
    #[deprecated(
820
        since = "2.3.0",
821
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
822
    )]
823
0
    pub const fn to_icu4c_value(self) -> u8 {
824
0
        self.0
825
0
    }
826
    /// Constructor from an ICU4C `UEastAsianWidth` value.
827
    #[deprecated(
828
        since = "2.3.0",
829
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
830
    )]
831
0
    pub const fn from_icu4c_value(value: u8) -> Self {
832
0
        Self(value)
833
0
    }
834
}
835
836
impl Default for EastAsianWidth {
837
0
    fn default() -> Self {
838
0
        Self::Neutral
839
0
    }
840
}
841
842
make_enumerated_property! {
843
    name: "East_Asian_Width";
844
    short_name: "ea";
845
    ident: EastAsianWidth;
846
    data_marker: crate::provider::PropertyEnumEastAsianWidthV1;
847
    singleton: SINGLETON_PROPERTY_ENUM_EAST_ASIAN_WIDTH_V1;
848
    ule_ty: u8;
849
}
850
851
/// Enumerated property `Line_Break`.
852
///
853
/// See "Line Breaking Properties" in UAX #14 for the summary of each property
854
/// value: <https://www.unicode.org/reports/tr14/#Properties>
855
///
856
/// The numeric value is compatible with `ULineBreak` in ICU4C.
857
///
858
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
859
///
860
/// # Example
861
///
862
/// ```
863
/// use icu::properties::{CodePointMapData, props::LineBreak};
864
///
865
/// assert_eq!(
866
///     CodePointMapData::<LineBreak>::new().get(')'),
867
///     LineBreak::CloseParenthesis
868
/// ); // U+0029: Right Parenthesis
869
/// assert_eq!(
870
///     CodePointMapData::<LineBreak>::new().get('ぁ'),
871
///     LineBreak::ConditionalJapaneseStarter
872
/// ); //U+3041: Hiragana Letter Small A
873
/// ```
874
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
875
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
876
#[allow(clippy::exhaustive_structs)] // newtype
877
#[repr(transparent)]
878
pub struct LineBreak(pub(crate) u8);
879
880
impl LineBreak {
881
    /// Returns an ICU4C `ULineBreak` value.
882
    #[deprecated(
883
        since = "2.3.0",
884
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
885
    )]
886
0
    pub const fn to_icu4c_value(self) -> u8 {
887
0
        self.0
888
0
    }
889
    /// Constructor from an ICU4C `ULineBreak` value.
890
    #[deprecated(
891
        since = "2.3.0",
892
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
893
    )]
894
0
    pub const fn from_icu4c_value(value: u8) -> Self {
895
0
        Self(value)
896
0
    }
897
}
898
899
impl Default for LineBreak {
900
0
    fn default() -> Self {
901
0
        Self::Unknown
902
0
    }
903
}
904
905
make_enumerated_property! {
906
    name: "Line_Break";
907
    short_name: "lb";
908
    ident: LineBreak;
909
    data_marker: crate::provider::PropertyEnumLineBreakV1;
910
    singleton: SINGLETON_PROPERTY_ENUM_LINE_BREAK_V1;
911
    ule_ty: u8;
912
}
913
914
/// Enumerated property `Grapheme_Cluster_Break`.
915
///
916
/// See "Default Grapheme Cluster Boundary Specification" in UAX #29 for the
917
/// summary of each property value:
918
/// <https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table>
919
///
920
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
921
///
922
/// # Example
923
///
924
/// ```
925
/// use icu::properties::{CodePointMapData, props::GraphemeClusterBreak};
926
///
927
/// assert_eq!(
928
///     CodePointMapData::<GraphemeClusterBreak>::new().get('🇦'),
929
///     GraphemeClusterBreak::RegionalIndicator
930
/// ); // U+1F1E6: Regional Indicator Symbol Letter A
931
/// assert_eq!(
932
///     CodePointMapData::<GraphemeClusterBreak>::new().get('ำ'),
933
///     GraphemeClusterBreak::SpacingMark
934
/// ); //U+0E33: Thai Character Sara Am
935
/// ```
936
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
937
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
938
#[allow(clippy::exhaustive_structs)] // this type is stable
939
#[repr(transparent)]
940
pub struct GraphemeClusterBreak(pub(crate) u8);
941
942
impl GraphemeClusterBreak {
943
    /// Returns an ICU4C `UGraphemeClusterBreak` value.
944
    #[deprecated(
945
        since = "2.3.0",
946
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
947
    )]
948
0
    pub const fn to_icu4c_value(self) -> u8 {
949
0
        self.0
950
0
    }
951
    /// Constructor from an ICU4C `UGraphemeClusterBreak` value.
952
    #[deprecated(
953
        since = "2.3.0",
954
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
955
    )]
956
0
    pub const fn from_icu4c_value(value: u8) -> Self {
957
0
        Self(value)
958
0
    }
959
}
960
961
impl Default for GraphemeClusterBreak {
962
0
    fn default() -> Self {
963
0
        Self::Other
964
0
    }
965
}
966
967
make_enumerated_property! {
968
    name: "Grapheme_Cluster_Break";
969
    short_name: "GCB";
970
    ident: GraphemeClusterBreak;
971
    data_marker: crate::provider::PropertyEnumGraphemeClusterBreakV1;
972
    singleton: SINGLETON_PROPERTY_ENUM_GRAPHEME_CLUSTER_BREAK_V1;
973
    ule_ty: u8;
974
}
975
976
/// Enumerated property `Word_Break`.
977
///
978
/// See "Default Word Boundary Specification" in UAX #29 for the summary of
979
/// each property value:
980
/// <https://www.unicode.org/reports/tr29/#Default_Word_Boundaries>.
981
///
982
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
983
///
984
/// # Example
985
///
986
/// ```
987
/// use icu::properties::{CodePointMapData, props::WordBreak};
988
///
989
/// assert_eq!(
990
///     CodePointMapData::<WordBreak>::new().get('.'),
991
///     WordBreak::MidNumLet
992
/// ); // U+002E: Full Stop
993
/// assert_eq!(
994
///     CodePointMapData::<WordBreak>::new().get(','),
995
///     WordBreak::MidNum
996
/// ); // U+FF0C: Fullwidth Comma
997
/// ```
998
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
999
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1000
#[allow(clippy::exhaustive_structs)] // newtype
1001
#[repr(transparent)]
1002
pub struct WordBreak(pub(crate) u8);
1003
1004
impl WordBreak {
1005
    /// Returns an ICU4C `UWordBreak` value.
1006
    #[deprecated(
1007
        since = "2.3.0",
1008
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1009
    )]
1010
0
    pub const fn to_icu4c_value(self) -> u8 {
1011
0
        self.0
1012
0
    }
1013
    /// Constructor from an ICU4C `UWordBreak` value.
1014
    #[deprecated(
1015
        since = "2.3.0",
1016
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1017
    )]
1018
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1019
0
        Self(value)
1020
0
    }
1021
}
1022
1023
impl Default for WordBreak {
1024
0
    fn default() -> Self {
1025
0
        Self::Other
1026
0
    }
1027
}
1028
1029
make_enumerated_property! {
1030
    name: "Word_Break";
1031
    short_name: "WB";
1032
    ident: WordBreak;
1033
    data_marker: crate::provider::PropertyEnumWordBreakV1;
1034
    singleton: SINGLETON_PROPERTY_ENUM_WORD_BREAK_V1;
1035
    ule_ty: u8;
1036
}
1037
1038
/// Enumerated property `Sentence_Break`.
1039
///
1040
/// See "Default Sentence Boundary Specification" in UAX #29 for the summary of
1041
/// each property value:
1042
/// <https://www.unicode.org/reports/tr29/#Default_Word_Boundaries>.
1043
///
1044
/// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation.
1045
///
1046
/// # Example
1047
///
1048
/// ```
1049
/// use icu::properties::{CodePointMapData, props::SentenceBreak};
1050
///
1051
/// assert_eq!(
1052
///     CodePointMapData::<SentenceBreak>::new().get('9'),
1053
///     SentenceBreak::Numeric
1054
/// ); // U+FF19: Fullwidth Digit Nine
1055
/// assert_eq!(
1056
///     CodePointMapData::<SentenceBreak>::new().get(','),
1057
///     SentenceBreak::SContinue
1058
/// ); // U+002C: Comma
1059
/// ```
1060
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1061
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1062
#[allow(clippy::exhaustive_structs)] // newtype
1063
#[repr(transparent)]
1064
pub struct SentenceBreak(pub(crate) u8);
1065
1066
impl SentenceBreak {
1067
    /// Returns an ICU4C `USentenceBreak` value.
1068
    #[deprecated(
1069
        since = "2.3.0",
1070
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1071
    )]
1072
0
    pub const fn to_icu4c_value(self) -> u8 {
1073
0
        self.0
1074
0
    }
1075
    /// Constructor from an ICU4C `USentenceBreak` value.
1076
    #[deprecated(
1077
        since = "2.3.0",
1078
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1079
    )]
1080
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1081
0
        Self(value)
1082
0
    }
1083
}
1084
1085
impl Default for SentenceBreak {
1086
0
    fn default() -> Self {
1087
0
        Self::Other
1088
0
    }
1089
}
1090
1091
make_enumerated_property! {
1092
    name: "Sentence_Break";
1093
    short_name: "SB";
1094
    ident: SentenceBreak;
1095
    data_marker: crate::provider::PropertyEnumSentenceBreakV1;
1096
    singleton: SINGLETON_PROPERTY_ENUM_SENTENCE_BREAK_V1;
1097
    ule_ty: u8;
1098
}
1099
1100
/// Property `Canonical_Combining_Class`.
1101
/// See UAX #15:
1102
/// <https://www.unicode.org/reports/tr15/>.
1103
///
1104
/// **Note:** See `icu::normalizer::properties::CanonicalCombiningClassMap` for the preferred API
1105
/// to look up the `Canonical_Combining_Class` property by scalar value.
1106
///
1107
/// # Example
1108
///
1109
/// ```
1110
/// use icu::properties::{CodePointMapData, props::CanonicalCombiningClass};
1111
///
1112
/// assert_eq!(
1113
///     CodePointMapData::<CanonicalCombiningClass>::new().get('a'),
1114
///     CanonicalCombiningClass::NotReordered
1115
/// ); // U+0061: LATIN SMALL LETTER A
1116
/// assert_eq!(
1117
///     CodePointMapData::<CanonicalCombiningClass>::new().get('\u{0301}'),
1118
///     CanonicalCombiningClass::Above
1119
/// ); // U+0301: COMBINING ACUTE ACCENT
1120
/// ```
1121
//
1122
// NOTE: The Pernosco debugger has special knowledge
1123
// of this struct. Please do not change the bit layout
1124
// or the crate-module-qualified name of this struct
1125
// without coordination.
1126
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1127
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1128
#[allow(clippy::exhaustive_structs)] // newtype
1129
#[repr(transparent)]
1130
pub struct CanonicalCombiningClass(pub u8);
1131
1132
impl CanonicalCombiningClass {
1133
    /// Returns an ICU4C `UCanonicalCombiningClass` value.
1134
    #[deprecated(
1135
        since = "2.3.0",
1136
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1137
    )]
1138
0
    pub const fn to_icu4c_value(self) -> u8 {
1139
0
        self.0
1140
0
    }
1141
    /// Constructor from an ICU4C `UCanonicalCombiningClass` value.
1142
    #[deprecated(
1143
        since = "2.3.0",
1144
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1145
    )]
1146
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1147
0
        Self(value)
1148
0
    }
1149
}
1150
1151
impl Default for CanonicalCombiningClass {
1152
0
    fn default() -> Self {
1153
0
        Self::NotReordered
1154
0
    }
1155
}
1156
1157
make_enumerated_property! {
1158
    name: "Canonical_Combining_Class";
1159
    short_name: "ccc";
1160
    ident: CanonicalCombiningClass;
1161
    data_marker: crate::provider::PropertyEnumCanonicalCombiningClassV1;
1162
    singleton: SINGLETON_PROPERTY_ENUM_CANONICAL_COMBINING_CLASS_V1;
1163
    ule_ty: u8;
1164
}
1165
1166
/// Property `Indic_Conjunct_Break`.
1167
/// See UAX #44:
1168
/// <https://www.unicode.org/reports/tr44/#Indic_Conjunct_Break>.
1169
///
1170
/// # Example
1171
///
1172
/// ```
1173
/// use icu::properties::{CodePointMapData, props::IndicConjunctBreak};
1174
///
1175
/// assert_eq!(
1176
///     CodePointMapData::<IndicConjunctBreak>::new().get('a'),
1177
///     IndicConjunctBreak::None
1178
/// );
1179
/// assert_eq!(
1180
///     CodePointMapData::<IndicConjunctBreak>::new().get('\u{094d}'),
1181
///     IndicConjunctBreak::Linker
1182
/// );
1183
/// assert_eq!(
1184
///     CodePointMapData::<IndicConjunctBreak>::new().get('\u{0915}'),
1185
///     IndicConjunctBreak::Consonant
1186
/// );
1187
/// assert_eq!(
1188
///     CodePointMapData::<IndicConjunctBreak>::new().get('\u{0300}'),
1189
///     IndicConjunctBreak::Extend
1190
/// );
1191
/// ```
1192
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1193
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1194
#[allow(clippy::exhaustive_structs)] // newtype
1195
#[repr(transparent)]
1196
pub struct IndicConjunctBreak(pub(crate) u8);
1197
1198
impl IndicConjunctBreak {
1199
    /// Returns an ICU4C `UIndicConjunctBreak` value.
1200
    #[deprecated(
1201
        since = "2.3.0",
1202
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1203
    )]
1204
0
    pub const fn to_icu4c_value(self) -> u8 {
1205
0
        self.0
1206
0
    }
1207
    /// Constructor from an ICU4C `UIndicConjunctBreak` value.
1208
    #[deprecated(
1209
        since = "2.3.0",
1210
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1211
    )]
1212
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1213
0
        Self(value)
1214
0
    }
1215
}
1216
1217
impl Default for IndicConjunctBreak {
1218
0
    fn default() -> Self {
1219
0
        Self::None
1220
0
    }
1221
}
1222
1223
make_enumerated_property! {
1224
    name: "Indic_Conjunct_Break";
1225
    short_name: "InCB";
1226
    ident: IndicConjunctBreak;
1227
    data_marker: crate::provider::PropertyEnumIndicConjunctBreakV1;
1228
    singleton: SINGLETON_PROPERTY_ENUM_INDIC_CONJUNCT_BREAK_V1;
1229
    ule_ty: u8;
1230
}
1231
1232
/// Property `Indic_Syllabic_Category`.
1233
/// See UAX #44:
1234
/// <https://www.unicode.org/reports/tr44/#Indic_Syllabic_Category>.
1235
///
1236
/// # Example
1237
///
1238
/// ```
1239
/// use icu::properties::{CodePointMapData, props::IndicSyllabicCategory};
1240
///
1241
/// assert_eq!(
1242
///     CodePointMapData::<IndicSyllabicCategory>::new().get('a'),
1243
///     IndicSyllabicCategory::Other
1244
/// );
1245
/// assert_eq!(
1246
///     CodePointMapData::<IndicSyllabicCategory>::new().get('\u{0900}'),
1247
///     IndicSyllabicCategory::Bindu
1248
/// ); // U+0900: DEVANAGARI SIGN INVERTED CANDRABINDU
1249
/// ```
1250
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1251
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1252
#[allow(clippy::exhaustive_structs)] // newtype
1253
#[repr(transparent)]
1254
pub struct IndicSyllabicCategory(pub(crate) u8);
1255
1256
impl IndicSyllabicCategory {
1257
    /// Returns an ICU4C `UIndicSyllabicCategory` value.
1258
    #[deprecated(
1259
        since = "2.3.0",
1260
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1261
    )]
1262
0
    pub const fn to_icu4c_value(self) -> u8 {
1263
0
        self.0
1264
0
    }
1265
    /// Constructor from an ICU4C `UIndicSyllabicCategory` value.
1266
    #[deprecated(
1267
        since = "2.3.0",
1268
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1269
    )]
1270
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1271
0
        Self(value)
1272
0
    }
1273
}
1274
1275
impl Default for IndicSyllabicCategory {
1276
0
    fn default() -> Self {
1277
0
        Self::Other
1278
0
    }
1279
}
1280
1281
make_enumerated_property! {
1282
    name: "Indic_Syllabic_Category";
1283
    short_name: "InSC";
1284
    ident: IndicSyllabicCategory;
1285
    data_marker: crate::provider::PropertyEnumIndicSyllabicCategoryV1;
1286
    singleton: SINGLETON_PROPERTY_ENUM_INDIC_SYLLABIC_CATEGORY_V1;
1287
    ule_ty: u8;
1288
}
1289
1290
/// Enumerated property `Joining_Group`.
1291
///
1292
/// See Section 9.2, Arabic Joining Groups in The Unicode Standard for the summary of
1293
/// each property value.
1294
///
1295
/// ```
1296
/// use icu::properties::{CodePointMapData, props::JoiningGroup};
1297
///
1298
/// assert_eq!(
1299
///     CodePointMapData::<JoiningGroup>::new().get('ع'),
1300
///     JoiningGroup::Ain,
1301
/// ); // U+0639: Arabic Letter Ain
1302
/// assert_eq!(
1303
///     CodePointMapData::<JoiningGroup>::new().get('ظ'),
1304
///     JoiningGroup::Tah,
1305
/// ); // U+0638: Arabic Letter Zah
1306
/// ```
1307
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1308
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1309
#[allow(clippy::exhaustive_structs)] // newtype
1310
#[repr(transparent)]
1311
pub struct JoiningGroup(pub(crate) u8);
1312
1313
impl JoiningGroup {
1314
    /// Returns an ICU4C `UJoiningType` value.
1315
    #[deprecated(
1316
        since = "2.3.0",
1317
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1318
    )]
1319
0
    pub const fn to_icu4c_value(self) -> u8 {
1320
0
        self.0
1321
0
    }
1322
    /// Constructor from an ICU4C `UJoiningType` value.
1323
    #[deprecated(
1324
        since = "2.3.0",
1325
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1326
    )]
1327
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1328
0
        Self(value)
1329
0
    }
1330
}
1331
1332
impl Default for JoiningGroup {
1333
0
    fn default() -> Self {
1334
0
        Self::NoJoiningGroup
1335
0
    }
1336
}
1337
1338
make_enumerated_property! {
1339
    name: "Joining_Group";
1340
    short_name: "jg";
1341
    ident: JoiningGroup;
1342
    data_marker: crate::provider::PropertyEnumJoiningGroupV1;
1343
    singleton: SINGLETON_PROPERTY_ENUM_JOINING_GROUP_V1;
1344
    ule_ty: u8;
1345
}
1346
1347
/// Enumerated property `Joining_Type`.
1348
///
1349
/// See Section 9.2, Arabic Cursive Joining in The Unicode Standard for the summary of
1350
/// each property value.
1351
///
1352
/// # Example
1353
///
1354
/// ```
1355
/// use icu::properties::{CodePointMapData, props::JoiningType};
1356
///
1357
/// assert_eq!(
1358
///     CodePointMapData::<JoiningType>::new().get('ؠ'),
1359
///     JoiningType::DualJoining
1360
/// ); // U+0620: Arabic Letter Kashmiri Yeh
1361
/// assert_eq!(
1362
///     CodePointMapData::<JoiningType>::new().get('𐫍'),
1363
///     JoiningType::LeftJoining
1364
/// ); // U+10ACD: Manichaean Letter Heth
1365
/// ```
1366
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1367
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1368
#[allow(clippy::exhaustive_structs)] // newtype
1369
#[repr(transparent)]
1370
pub struct JoiningType(pub(crate) u8);
1371
1372
impl JoiningType {
1373
    /// Returns an ICU4C `UJoiningType` value.
1374
    #[deprecated(
1375
        since = "2.3.0",
1376
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1377
    )]
1378
0
    pub const fn to_icu4c_value(self) -> u8 {
1379
0
        self.0
1380
0
    }
1381
    /// Constructor from an ICU4C `UJoiningType` value.
1382
    #[deprecated(
1383
        since = "2.3.0",
1384
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1385
    )]
1386
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1387
0
        Self(value)
1388
0
    }
1389
}
1390
1391
impl Default for JoiningType {
1392
0
    fn default() -> Self {
1393
0
        Self::NonJoining
1394
0
    }
1395
}
1396
1397
make_enumerated_property! {
1398
    name: "Joining_Type";
1399
    short_name: "jt";
1400
    ident: JoiningType;
1401
    data_marker: crate::provider::PropertyEnumJoiningTypeV1;
1402
    singleton: SINGLETON_PROPERTY_ENUM_JOINING_TYPE_V1;
1403
    ule_ty: u8;
1404
}
1405
1406
/// Property `Vertical_Orientation`
1407
///
1408
/// See UTR #50:
1409
/// <https://www.unicode.org/reports/tr50/#vo>
1410
///
1411
/// # Example
1412
///
1413
/// ```
1414
/// use icu::properties::{CodePointMapData, props::VerticalOrientation};
1415
///
1416
/// assert_eq!(
1417
///     CodePointMapData::<VerticalOrientation>::new().get('a'),
1418
///     VerticalOrientation::Rotated
1419
/// );
1420
/// assert_eq!(
1421
///     CodePointMapData::<VerticalOrientation>::new().get('§'),
1422
///     VerticalOrientation::Upright
1423
/// );
1424
/// assert_eq!(
1425
///     CodePointMapData::<VerticalOrientation>::new().get32(0x2329),
1426
///     VerticalOrientation::TransformedRotated
1427
/// );
1428
/// assert_eq!(
1429
///     CodePointMapData::<VerticalOrientation>::new().get32(0x3001),
1430
///     VerticalOrientation::TransformedUpright
1431
/// );
1432
/// ```
1433
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1434
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1435
#[allow(clippy::exhaustive_structs)] // newtype
1436
#[repr(transparent)]
1437
pub struct VerticalOrientation(pub(crate) u8);
1438
1439
impl VerticalOrientation {
1440
    /// Returns an ICU4C `UVerticalOrientation` value.
1441
    #[deprecated(
1442
        since = "2.3.0",
1443
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1444
    )]
1445
0
    pub const fn to_icu4c_value(self) -> u8 {
1446
0
        self.0
1447
0
    }
1448
    /// Constructor from an ICU4C `UVerticalOrientation` value.
1449
    #[deprecated(
1450
        since = "2.3.0",
1451
        note = "please comment on https://github.com/unicode-org/icu4x/issues/6067 if you need this"
1452
    )]
1453
0
    pub const fn from_icu4c_value(value: u8) -> Self {
1454
0
        Self(value)
1455
0
    }
1456
}
1457
1458
impl Default for VerticalOrientation {
1459
0
    fn default() -> Self {
1460
0
        Self::Rotated
1461
0
    }
1462
}
1463
1464
make_enumerated_property! {
1465
    name: "Vertical_Orientation";
1466
    short_name: "vo";
1467
    ident: VerticalOrientation;
1468
    data_marker: crate::provider::PropertyEnumVerticalOrientationV1;
1469
    singleton: SINGLETON_PROPERTY_ENUM_VERTICAL_ORIENTATION_V1;
1470
    ule_ty: u8;
1471
}
1472
1473
pub use crate::code_point_set::BinaryProperty;
1474
1475
macro_rules! make_binary_property {
1476
    (
1477
        name: $name:literal;
1478
        short_name: $short_name:literal;
1479
        ident: $ident:ident;
1480
        data_marker: $data_marker:ty;
1481
        singleton: $singleton:ident;
1482
            $(#[$doc:meta])+
1483
    ) => {
1484
        $(#[$doc])+
1485
        #[derive(Debug)]
1486
        #[non_exhaustive]
1487
        pub struct $ident;
1488
1489
        #[allow(deprecated)]
1490
        impl crate::private::Sealed for $ident {}
1491
1492
        #[allow(deprecated)]
1493
        impl BinaryProperty for $ident {
1494
            type DataMarker = $data_marker;
1495
            #[cfg(feature = "compiled_data")]
1496
            const SINGLETON: &'static crate::provider::PropertyCodePointSet<'static> =
1497
                &crate::provider::Baked::$singleton;
1498
            const NAME: &'static [u8] = $name.as_bytes();
1499
            const SHORT_NAME: &'static [u8] = $short_name.as_bytes();
1500
        }
1501
    };
1502
}
1503
1504
make_binary_property! {
1505
    name: "ASCII_Hex_Digit";
1506
    short_name: "AHex";
1507
    ident: AsciiHexDigit;
1508
    data_marker: crate::provider::PropertyBinaryAsciiHexDigitV1;
1509
    singleton: SINGLETON_PROPERTY_BINARY_ASCII_HEX_DIGIT_V1;
1510
    /// ASCII characters commonly used for the representation of hexadecimal numbers.
1511
    ///
1512
    /// # Example
1513
    ///
1514
    /// ```
1515
    /// use icu::properties::CodePointSetData;
1516
    /// use icu::properties::props::AsciiHexDigit;
1517
    ///
1518
    /// let ascii_hex_digit = CodePointSetData::new::<AsciiHexDigit>();
1519
    ///
1520
    /// assert!(ascii_hex_digit.contains('3'));
1521
    /// assert!(!ascii_hex_digit.contains('੩'));  // U+0A69 GURMUKHI DIGIT THREE
1522
    /// assert!(ascii_hex_digit.contains('A'));
1523
    /// assert!(!ascii_hex_digit.contains('Ä'));  // U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
1524
    /// ```
1525
}
1526
1527
make_binary_property! {
1528
    name: "alnum";
1529
    short_name: "alnum";
1530
    ident: Alnum;
1531
    data_marker: crate::provider::PropertyBinaryAlnumV1;
1532
    singleton: SINGLETON_PROPERTY_BINARY_ALNUM_V1;
1533
    /// Characters with the `Alphabetic` or `Decimal_Number` property.
1534
    ///
1535
    /// This is defined for POSIX compatibility.
1536
}
1537
1538
make_binary_property! {
1539
    name: "Alphabetic";
1540
    short_name: "Alpha";
1541
    ident: Alphabetic;
1542
    data_marker: crate::provider::PropertyBinaryAlphabeticV1;
1543
    singleton: SINGLETON_PROPERTY_BINARY_ALPHABETIC_V1;
1544
    /// Alphabetic characters.
1545
    ///
1546
    /// # Example
1547
    ///
1548
    /// ```
1549
    /// use icu::properties::CodePointSetData;
1550
    /// use icu::properties::props::Alphabetic;
1551
    ///
1552
    /// let alphabetic = CodePointSetData::new::<Alphabetic>();
1553
    ///
1554
    /// assert!(!alphabetic.contains('3'));
1555
    /// assert!(!alphabetic.contains('੩'));  // U+0A69 GURMUKHI DIGIT THREE
1556
    /// assert!(alphabetic.contains('A'));
1557
    /// assert!(alphabetic.contains('Ä'));  // U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
1558
    /// ```
1559
1560
}
1561
1562
make_binary_property! {
1563
    name: "Bidi_Control";
1564
    short_name: "Bidi_C";
1565
    ident: BidiControl;
1566
    data_marker: crate::provider::PropertyBinaryBidiControlV1;
1567
    singleton: SINGLETON_PROPERTY_BINARY_BIDI_CONTROL_V1;
1568
    /// Format control characters which have specific functions in the Unicode Bidirectional
1569
    /// Algorithm.
1570
    ///
1571
    /// # Example
1572
    ///
1573
    /// ```
1574
    /// use icu::properties::CodePointSetData;
1575
    /// use icu::properties::props::BidiControl;
1576
    ///
1577
    /// let bidi_control = CodePointSetData::new::<BidiControl>();
1578
    ///
1579
    /// assert!(bidi_control.contains('\u{200F}'));  // RIGHT-TO-LEFT MARK
1580
    /// assert!(!bidi_control.contains('ش'));  // U+0634 ARABIC LETTER SHEEN
1581
    /// ```
1582
1583
}
1584
1585
make_binary_property! {
1586
    name: "Bidi_Mirrored";
1587
    short_name: "Bidi_M";
1588
    ident: BidiMirrored;
1589
    data_marker: crate::provider::PropertyBinaryBidiMirroredV1;
1590
    singleton: SINGLETON_PROPERTY_BINARY_BIDI_MIRRORED_V1;
1591
    /// Characters that are mirrored in bidirectional text.
1592
    ///
1593
    /// # Example
1594
    ///
1595
    /// ```
1596
    /// use icu::properties::CodePointSetData;
1597
    /// use icu::properties::props::BidiMirrored;
1598
    ///
1599
    /// let bidi_mirrored = CodePointSetData::new::<BidiMirrored>();
1600
    ///
1601
    /// assert!(bidi_mirrored.contains('['));
1602
    /// assert!(bidi_mirrored.contains(']'));
1603
    /// assert!(bidi_mirrored.contains('∑'));  // U+2211 N-ARY SUMMATION
1604
    /// assert!(!bidi_mirrored.contains('ཉ'));  // U+0F49 TIBETAN LETTER NYA
1605
    /// ```
1606
1607
}
1608
1609
make_binary_property! {
1610
    name: "blank";
1611
    short_name: "blank";
1612
    ident: Blank;
1613
    data_marker: crate::provider::PropertyBinaryBlankV1;
1614
    singleton: SINGLETON_PROPERTY_BINARY_BLANK_V1;
1615
    /// Horizontal whitespace characters
1616
1617
}
1618
1619
make_binary_property! {
1620
    name: "Cased";
1621
    short_name: "Cased";
1622
    ident: Cased;
1623
    data_marker: crate::provider::PropertyBinaryCasedV1;
1624
    singleton: SINGLETON_PROPERTY_BINARY_CASED_V1;
1625
    /// Uppercase, lowercase, and titlecase characters.
1626
    ///
1627
    /// # Example
1628
    ///
1629
    /// ```
1630
    /// use icu::properties::CodePointSetData;
1631
    /// use icu::properties::props::Cased;
1632
    ///
1633
    /// let cased = CodePointSetData::new::<Cased>();
1634
    ///
1635
    /// assert!(cased.contains('Ꙡ'));  // U+A660 CYRILLIC CAPITAL LETTER REVERSED TSE
1636
    /// assert!(!cased.contains('ދ'));  // U+078B THAANA LETTER DHAALU
1637
    /// ```
1638
1639
}
1640
1641
make_binary_property! {
1642
    name: "Case_Ignorable";
1643
    short_name: "CI";
1644
    ident: CaseIgnorable;
1645
    data_marker: crate::provider::PropertyBinaryCaseIgnorableV1;
1646
    singleton: SINGLETON_PROPERTY_BINARY_CASE_IGNORABLE_V1;
1647
    /// Characters which are ignored for casing purposes.
1648
    ///
1649
    /// # Example
1650
    ///
1651
    /// ```
1652
    /// use icu::properties::CodePointSetData;
1653
    /// use icu::properties::props::CaseIgnorable;
1654
    ///
1655
    /// let case_ignorable = CodePointSetData::new::<CaseIgnorable>();
1656
    ///
1657
    /// assert!(case_ignorable.contains(':'));
1658
    /// assert!(!case_ignorable.contains('λ'));  // U+03BB GREEK SMALL LETTER LAMBDA
1659
    /// ```
1660
1661
}
1662
1663
make_binary_property! {
1664
    name: "Full_Composition_Exclusion";
1665
    short_name: "Comp_Ex";
1666
    ident: FullCompositionExclusion;
1667
    data_marker: crate::provider::PropertyBinaryFullCompositionExclusionV1;
1668
    singleton: SINGLETON_PROPERTY_BINARY_FULL_COMPOSITION_EXCLUSION_V1;
1669
    /// Characters that are excluded from composition.
1670
    ///
1671
    /// See <https://unicode.org/Public/UNIDATA/CompositionExclusions.txt>
1672
1673
}
1674
1675
make_binary_property! {
1676
    name: "Changes_When_Casefolded";
1677
    short_name: "CWCF";
1678
    ident: ChangesWhenCasefolded;
1679
    data_marker: crate::provider::PropertyBinaryChangesWhenCasefoldedV1;
1680
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_CASEFOLDED_V1;
1681
    /// Characters whose normalized forms are not stable under case folding.
1682
    ///
1683
    /// # Example
1684
    ///
1685
    /// ```
1686
    /// use icu::properties::CodePointSetData;
1687
    /// use icu::properties::props::ChangesWhenCasefolded;
1688
    ///
1689
    /// let changes_when_casefolded = CodePointSetData::new::<ChangesWhenCasefolded>();
1690
    ///
1691
    /// assert!(changes_when_casefolded.contains('ß'));  // U+00DF LATIN SMALL LETTER SHARP S
1692
    /// assert!(!changes_when_casefolded.contains('ᜉ'));  // U+1709 TAGALOG LETTER PA
1693
    /// ```
1694
1695
}
1696
1697
make_binary_property! {
1698
    name: "Changes_When_Casemapped";
1699
    short_name: "CWCM";
1700
    ident: ChangesWhenCasemapped;
1701
    data_marker: crate::provider::PropertyBinaryChangesWhenCasemappedV1;
1702
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_CASEMAPPED_V1;
1703
    /// Characters which may change when they undergo case mapping.
1704
1705
}
1706
1707
make_binary_property! {
1708
    name: "Changes_When_NFKC_Casefolded";
1709
    short_name: "CWKCF";
1710
    ident: ChangesWhenNfkcCasefolded;
1711
    data_marker: crate::provider::PropertyBinaryChangesWhenNfkcCasefoldedV1;
1712
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_NFKC_CASEFOLDED_V1;
1713
    /// Characters which are not identical to their `NFKC_Casefold` mapping.
1714
    ///
1715
    /// # Example
1716
    ///
1717
    /// ```
1718
    /// use icu::properties::CodePointSetData;
1719
    /// use icu::properties::props::ChangesWhenNfkcCasefolded;
1720
    ///
1721
    /// let changes_when_nfkc_casefolded = CodePointSetData::new::<ChangesWhenNfkcCasefolded>();
1722
    ///
1723
    /// assert!(changes_when_nfkc_casefolded.contains('🄵'));  // U+1F135 SQUARED LATIN CAPITAL LETTER F
1724
    /// assert!(!changes_when_nfkc_casefolded.contains('f'));
1725
    /// ```
1726
1727
}
1728
1729
make_binary_property! {
1730
    name: "Changes_When_Lowercased";
1731
    short_name: "CWL";
1732
    ident: ChangesWhenLowercased;
1733
    data_marker: crate::provider::PropertyBinaryChangesWhenLowercasedV1;
1734
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_LOWERCASED_V1;
1735
    /// Characters whose normalized forms are not stable under a `toLowercase` mapping.
1736
    ///
1737
    /// # Example
1738
    ///
1739
    /// ```
1740
    /// use icu::properties::CodePointSetData;
1741
    /// use icu::properties::props::ChangesWhenLowercased;
1742
    ///
1743
    /// let changes_when_lowercased = CodePointSetData::new::<ChangesWhenLowercased>();
1744
    ///
1745
    /// assert!(changes_when_lowercased.contains('Ⴔ'));  // U+10B4 GEORGIAN CAPITAL LETTER PHAR
1746
    /// assert!(!changes_when_lowercased.contains('ფ'));  // U+10E4 GEORGIAN LETTER PHAR
1747
    /// ```
1748
1749
}
1750
1751
make_binary_property! {
1752
    name: "Changes_When_Titlecased";
1753
    short_name: "CWT";
1754
    ident: ChangesWhenTitlecased;
1755
    data_marker: crate::provider::PropertyBinaryChangesWhenTitlecasedV1;
1756
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_TITLECASED_V1;
1757
    /// Characters whose normalized forms are not stable under a `toTitlecase` mapping.
1758
    ///
1759
    /// # Example
1760
    ///
1761
    /// ```
1762
    /// use icu::properties::CodePointSetData;
1763
    /// use icu::properties::props::ChangesWhenTitlecased;
1764
    ///
1765
    /// let changes_when_titlecased = CodePointSetData::new::<ChangesWhenTitlecased>();
1766
    ///
1767
    /// assert!(changes_when_titlecased.contains('æ'));  // U+00E6 LATIN SMALL LETTER AE
1768
    /// assert!(!changes_when_titlecased.contains('Æ'));  // U+00E6 LATIN CAPITAL LETTER AE
1769
    /// ```
1770
1771
}
1772
1773
make_binary_property! {
1774
    name: "Changes_When_Uppercased";
1775
    short_name: "CWU";
1776
    ident: ChangesWhenUppercased;
1777
    data_marker: crate::provider::PropertyBinaryChangesWhenUppercasedV1;
1778
    singleton: SINGLETON_PROPERTY_BINARY_CHANGES_WHEN_UPPERCASED_V1;
1779
    /// Characters whose normalized forms are not stable under a `toUppercase` mapping.
1780
    ///
1781
    /// # Example
1782
    ///
1783
    /// ```
1784
    /// use icu::properties::CodePointSetData;
1785
    /// use icu::properties::props::ChangesWhenUppercased;
1786
    ///
1787
    /// let changes_when_uppercased = CodePointSetData::new::<ChangesWhenUppercased>();
1788
    ///
1789
    /// assert!(changes_when_uppercased.contains('ւ'));  // U+0582 ARMENIAN SMALL LETTER YIWN
1790
    /// assert!(!changes_when_uppercased.contains('Ւ'));  // U+0552 ARMENIAN CAPITAL LETTER YIWN
1791
    /// ```
1792
1793
}
1794
1795
make_binary_property! {
1796
    name: "Dash";
1797
    short_name: "Dash";
1798
    ident: Dash;
1799
    data_marker: crate::provider::PropertyBinaryDashV1;
1800
    singleton: SINGLETON_PROPERTY_BINARY_DASH_V1;
1801
    /// Punctuation characters explicitly called out as dashes in the Unicode Standard, plus
1802
    /// their compatibility equivalents.
1803
    ///
1804
    /// # Example
1805
    ///
1806
    /// ```
1807
    /// use icu::properties::CodePointSetData;
1808
    /// use icu::properties::props::Dash;
1809
    ///
1810
    /// let dash = CodePointSetData::new::<Dash>();
1811
    ///
1812
    /// assert!(dash.contains('⸺'));  // U+2E3A TWO-EM DASH
1813
    /// assert!(dash.contains('-'));  // U+002D
1814
    /// assert!(!dash.contains('='));  // U+003D
1815
    /// ```
1816
1817
}
1818
1819
make_binary_property! {
1820
    name: "Deprecated";
1821
    short_name: "Dep";
1822
    ident: Deprecated;
1823
    data_marker: crate::provider::PropertyBinaryDeprecatedV1;
1824
    singleton: SINGLETON_PROPERTY_BINARY_DEPRECATED_V1;
1825
    /// Deprecated characters.
1826
    ///
1827
    /// No characters will ever be removed from the standard, but the
1828
    /// usage of deprecated characters is strongly discouraged.
1829
    ///
1830
    /// # Example
1831
    ///
1832
    /// ```
1833
    /// use icu::properties::CodePointSetData;
1834
    /// use icu::properties::props::Deprecated;
1835
    ///
1836
    /// let deprecated = CodePointSetData::new::<Deprecated>();
1837
    ///
1838
    /// assert!(deprecated.contains('ឣ'));  // U+17A3 KHMER INDEPENDENT VOWEL QAQ
1839
    /// assert!(!deprecated.contains('A'));
1840
    /// ```
1841
1842
}
1843
1844
make_binary_property! {
1845
    name: "Default_Ignorable_Code_Point";
1846
    short_name: "DI";
1847
    ident: DefaultIgnorableCodePoint;
1848
    data_marker: crate::provider::PropertyBinaryDefaultIgnorableCodePointV1;
1849
    singleton: SINGLETON_PROPERTY_BINARY_DEFAULT_IGNORABLE_CODE_POINT_V1;
1850
    /// For programmatic determination of default ignorable code points.
1851
    ///
1852
    /// New characters that
1853
    /// should be ignored in rendering (unless explicitly supported) will be assigned in these
1854
    /// ranges, permitting programs to correctly handle the default rendering of such
1855
    /// characters when not otherwise supported.
1856
    ///
1857
    /// # Example
1858
    ///
1859
    /// ```
1860
    /// use icu::properties::CodePointSetData;
1861
    /// use icu::properties::props::DefaultIgnorableCodePoint;
1862
    ///
1863
    /// let default_ignorable_code_point = CodePointSetData::new::<DefaultIgnorableCodePoint>();
1864
    ///
1865
    /// assert!(default_ignorable_code_point.contains('\u{180B}'));  // MONGOLIAN FREE VARIATION SELECTOR ONE
1866
    /// assert!(!default_ignorable_code_point.contains('E'));
1867
    /// ```
1868
1869
}
1870
1871
make_binary_property! {
1872
    name: "Diacritic";
1873
    short_name: "Dia";
1874
    ident: Diacritic;
1875
    data_marker: crate::provider::PropertyBinaryDiacriticV1;
1876
    singleton: SINGLETON_PROPERTY_BINARY_DIACRITIC_V1;
1877
    /// Characters that linguistically modify the meaning of another character to which they apply.
1878
    ///
1879
    /// # Example
1880
    ///
1881
    /// ```
1882
    /// use icu::properties::CodePointSetData;
1883
    /// use icu::properties::props::Diacritic;
1884
    ///
1885
    /// let diacritic = CodePointSetData::new::<Diacritic>();
1886
    ///
1887
    /// assert!(diacritic.contains('\u{05B3}'));  // HEBREW POINT HATAF QAMATS
1888
    /// assert!(!diacritic.contains('א'));  // U+05D0 HEBREW LETTER ALEF
1889
    /// ```
1890
1891
}
1892
1893
make_binary_property! {
1894
    name: "Emoji_Modifier_Base";
1895
    short_name: "EBase";
1896
    ident: EmojiModifierBase;
1897
    data_marker: crate::provider::PropertyBinaryEmojiModifierBaseV1;
1898
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_MODIFIER_BASE_V1;
1899
    /// Characters that can serve as a base for emoji modifiers.
1900
    ///
1901
    /// # Example
1902
    ///
1903
    /// ```
1904
    /// use icu::properties::CodePointSetData;
1905
    /// use icu::properties::props::EmojiModifierBase;
1906
    ///
1907
    /// let emoji_modifier_base = CodePointSetData::new::<EmojiModifierBase>();
1908
    ///
1909
    /// assert!(emoji_modifier_base.contains('✊'));  // U+270A RAISED FIST
1910
    /// assert!(!emoji_modifier_base.contains('⛰'));  // U+26F0 MOUNTAIN
1911
    /// ```
1912
1913
}
1914
1915
make_binary_property! {
1916
    name: "Emoji_Component";
1917
    short_name: "EComp";
1918
    ident: EmojiComponent;
1919
    data_marker: crate::provider::PropertyBinaryEmojiComponentV1;
1920
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_COMPONENT_V1;
1921
    /// Characters used in emoji sequences that normally do not appear on emoji keyboards as
1922
    /// separate choices, such as base characters for emoji keycaps.
1923
    ///
1924
    /// # Example
1925
    ///
1926
    /// ```
1927
    /// use icu::properties::CodePointSetData;
1928
    /// use icu::properties::props::EmojiComponent;
1929
    ///
1930
    /// let emoji_component = CodePointSetData::new::<EmojiComponent>();
1931
    ///
1932
    /// assert!(emoji_component.contains('🇹'));  // U+1F1F9 REGIONAL INDICATOR SYMBOL LETTER T
1933
    /// assert!(emoji_component.contains('\u{20E3}'));  // COMBINING ENCLOSING KEYCAP
1934
    /// assert!(emoji_component.contains('7'));
1935
    /// assert!(!emoji_component.contains('T'));
1936
    /// ```
1937
1938
}
1939
1940
make_binary_property! {
1941
    name: "Emoji_Modifier";
1942
    short_name: "EMod";
1943
    ident: EmojiModifier;
1944
    data_marker: crate::provider::PropertyBinaryEmojiModifierV1;
1945
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_MODIFIER_V1;
1946
    /// Characters that are emoji modifiers.
1947
    ///
1948
    /// # Example
1949
    ///
1950
    /// ```
1951
    /// use icu::properties::CodePointSetData;
1952
    /// use icu::properties::props::EmojiModifier;
1953
    ///
1954
    /// let emoji_modifier = CodePointSetData::new::<EmojiModifier>();
1955
    ///
1956
    /// assert!(emoji_modifier.contains('\u{1F3FD}'));  // EMOJI MODIFIER FITZPATRICK TYPE-4
1957
    /// assert!(!emoji_modifier.contains('\u{200C}'));  // ZERO WIDTH NON-JOINER
1958
    /// ```
1959
1960
}
1961
1962
make_binary_property! {
1963
    name: "Emoji";
1964
    short_name: "Emoji";
1965
    ident: Emoji;
1966
    data_marker: crate::provider::PropertyBinaryEmojiV1;
1967
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_V1;
1968
    /// Characters that are emoji.
1969
    ///
1970
    /// # Example
1971
    ///
1972
    /// ```
1973
    /// use icu::properties::CodePointSetData;
1974
    /// use icu::properties::props::Emoji;
1975
    ///
1976
    /// let emoji = CodePointSetData::new::<Emoji>();
1977
    ///
1978
    /// assert!(emoji.contains('🔥'));  // U+1F525 FIRE
1979
    /// assert!(!emoji.contains('V'));
1980
    /// ```
1981
1982
}
1983
1984
make_binary_property! {
1985
    name: "Emoji_Presentation";
1986
    short_name: "EPres";
1987
    ident: EmojiPresentation;
1988
    data_marker: crate::provider::PropertyBinaryEmojiPresentationV1;
1989
    singleton: SINGLETON_PROPERTY_BINARY_EMOJI_PRESENTATION_V1;
1990
    /// Characters that have emoji presentation by default.
1991
    ///
1992
    /// # Example
1993
    ///
1994
    /// ```
1995
    /// use icu::properties::CodePointSetData;
1996
    /// use icu::properties::props::EmojiPresentation;
1997
    ///
1998
    /// let emoji_presentation = CodePointSetData::new::<EmojiPresentation>();
1999
    ///
2000
    /// assert!(emoji_presentation.contains('🦬')); // U+1F9AC BISON
2001
    /// assert!(!emoji_presentation.contains('♻'));  // U+267B BLACK UNIVERSAL RECYCLING SYMBOL
2002
    /// ```
2003
2004
}
2005
2006
make_binary_property! {
2007
    name: "Extender";
2008
    short_name: "Ext";
2009
    ident: Extender;
2010
    data_marker: crate::provider::PropertyBinaryExtenderV1;
2011
    singleton: SINGLETON_PROPERTY_BINARY_EXTENDER_V1;
2012
    /// Characters whose principal function is to extend the value of a preceding alphabetic
2013
    /// character or to extend the shape of adjacent characters.
2014
    ///
2015
    /// # Example
2016
    ///
2017
    /// ```
2018
    /// use icu::properties::CodePointSetData;
2019
    /// use icu::properties::props::Extender;
2020
    ///
2021
    /// let extender = CodePointSetData::new::<Extender>();
2022
    ///
2023
    /// assert!(extender.contains('ヾ'));  // U+30FE KATAKANA VOICED ITERATION MARK
2024
    /// assert!(extender.contains('ー'));  // U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK
2025
    /// assert!(!extender.contains('・'));  // U+30FB KATAKANA MIDDLE DOT
2026
    /// ```
2027
2028
}
2029
2030
make_binary_property! {
2031
    name: "Extended_Pictographic";
2032
    short_name: "ExtPict";
2033
    ident: ExtendedPictographic;
2034
    data_marker: crate::provider::PropertyBinaryExtendedPictographicV1;
2035
    singleton: SINGLETON_PROPERTY_BINARY_EXTENDED_PICTOGRAPHIC_V1;
2036
    /// Pictographic symbols, as well as reserved ranges in blocks largely associated with
2037
    /// emoji characters
2038
    ///
2039
    /// # Example
2040
    ///
2041
    /// ```
2042
    /// use icu::properties::CodePointSetData;
2043
    /// use icu::properties::props::ExtendedPictographic;
2044
    ///
2045
    /// let extended_pictographic = CodePointSetData::new::<ExtendedPictographic>();
2046
    ///
2047
    /// assert!(extended_pictographic.contains('🥳')); // U+1F973 FACE WITH PARTY HORN AND PARTY HAT
2048
    /// assert!(!extended_pictographic.contains('🇪'));  // U+1F1EA REGIONAL INDICATOR SYMBOL LETTER E
2049
    /// ```
2050
2051
}
2052
2053
make_binary_property! {
2054
    name: "graph";
2055
    short_name: "graph";
2056
    ident: Graph;
2057
    data_marker: crate::provider::PropertyBinaryGraphV1;
2058
    singleton: SINGLETON_PROPERTY_BINARY_GRAPH_V1;
2059
    /// Invisible characters.
2060
    ///
2061
    /// This is defined for POSIX compatibility.
2062
2063
}
2064
2065
make_binary_property! {
2066
    name: "Grapheme_Base";
2067
    short_name: "Gr_Base";
2068
    ident: GraphemeBase;
2069
    data_marker: crate::provider::PropertyBinaryGraphemeBaseV1;
2070
    singleton: SINGLETON_PROPERTY_BINARY_GRAPHEME_BASE_V1;
2071
    /// Property used together with the definition of Standard Korean Syllable Block to define
2072
    /// "Grapheme base".
2073
    ///
2074
    /// See D58 in Chapter 3, Conformance in the Unicode Standard.
2075
    ///
2076
    /// # Example
2077
    ///
2078
    /// ```
2079
    /// use icu::properties::CodePointSetData;
2080
    /// use icu::properties::props::GraphemeBase;
2081
    ///
2082
    /// let grapheme_base = CodePointSetData::new::<GraphemeBase>();
2083
    ///
2084
    /// assert!(grapheme_base.contains('ക'));  // U+0D15 MALAYALAM LETTER KA
2085
    /// assert!(grapheme_base.contains('\u{0D3F}'));  // U+0D3F MALAYALAM VOWEL SIGN I
2086
    /// assert!(!grapheme_base.contains('\u{0D3E}'));  // U+0D3E MALAYALAM VOWEL SIGN AA
2087
    /// ```
2088
2089
}
2090
2091
make_binary_property! {
2092
    name: "Grapheme_Extend";
2093
    short_name: "Gr_Ext";
2094
    ident: GraphemeExtend;
2095
    data_marker: crate::provider::PropertyBinaryGraphemeExtendV1;
2096
    singleton: SINGLETON_PROPERTY_BINARY_GRAPHEME_EXTEND_V1;
2097
    /// Property used to define "Grapheme extender".
2098
    ///
2099
    /// See D59 in Chapter 3, Conformance in the
2100
    /// Unicode Standard.
2101
    ///
2102
    /// # Example
2103
    ///
2104
    /// ```
2105
    /// use icu::properties::CodePointSetData;
2106
    /// use icu::properties::props::GraphemeExtend;
2107
    ///
2108
    /// let grapheme_extend = CodePointSetData::new::<GraphemeExtend>();
2109
    ///
2110
    /// assert!(!grapheme_extend.contains('ക'));  // U+0D15 MALAYALAM LETTER KA
2111
    /// assert!(!grapheme_extend.contains('\u{0D3F}'));  // U+0D3F MALAYALAM VOWEL SIGN I
2112
    /// assert!(grapheme_extend.contains('\u{0D3E}'));  // U+0D3E MALAYALAM VOWEL SIGN AA
2113
    /// ```
2114
2115
}
2116
2117
make_binary_property! {
2118
    name: "Grapheme_Link";
2119
    short_name: "Gr_Link";
2120
    ident: GraphemeLink;
2121
    data_marker: crate::provider::PropertyBinaryGraphemeLinkV1;
2122
    singleton: SINGLETON_PROPERTY_BINARY_GRAPHEME_LINK_V1;
2123
    /// Deprecated property.
2124
    ///
2125
    /// Formerly proposed for programmatic determination of grapheme
2126
    /// cluster boundaries.
2127
}
2128
2129
make_binary_property! {
2130
    name: "Hex_Digit";
2131
    short_name: "Hex";
2132
    ident: HexDigit;
2133
    data_marker: crate::provider::PropertyBinaryHexDigitV1;
2134
    singleton: SINGLETON_PROPERTY_BINARY_HEX_DIGIT_V1;
2135
    /// Characters commonly used for the representation of hexadecimal numbers, plus their
2136
    /// compatibility equivalents.
2137
    ///
2138
    /// # Example
2139
    ///
2140
    /// ```
2141
    /// use icu::properties::CodePointSetData;
2142
    /// use icu::properties::props::HexDigit;
2143
    ///
2144
    /// let hex_digit = CodePointSetData::new::<HexDigit>();
2145
    ///
2146
    /// assert!(hex_digit.contains('0'));
2147
    /// assert!(!hex_digit.contains('੩'));  // U+0A69 GURMUKHI DIGIT THREE
2148
    /// assert!(hex_digit.contains('f'));
2149
    /// assert!(hex_digit.contains('f'));  // U+FF46 FULLWIDTH LATIN SMALL LETTER F
2150
    /// assert!(hex_digit.contains('F'));  // U+FF26 FULLWIDTH LATIN CAPITAL LETTER F
2151
    /// assert!(!hex_digit.contains('Ä'));  // U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS
2152
    /// ```
2153
}
2154
2155
make_binary_property! {
2156
    name: "Hyphen";
2157
    short_name: "Hyphen";
2158
    ident: Hyphen;
2159
    data_marker: crate::provider::PropertyBinaryHyphenV1;
2160
    singleton: SINGLETON_PROPERTY_BINARY_HYPHEN_V1;
2161
    /// Deprecated property.
2162
    ///
2163
    /// Dashes which are used to mark connections between pieces of
2164
    /// words, plus the Katakana middle dot.
2165
}
2166
2167
make_binary_property! {
2168
    name: "ID_Compat_Math_Continue";
2169
    short_name: "ID_Compat_Math_Continue";
2170
    ident: IdCompatMathContinue;
2171
    data_marker: crate::provider::PropertyBinaryIdCompatMathContinueV1;
2172
    singleton: SINGLETON_PROPERTY_BINARY_ID_COMPAT_MATH_CONTINUE_V1;
2173
    /// `ID_Compat_Math_Continue` Property
2174
}
2175
2176
make_binary_property! {
2177
    name: "ID_Compat_Math_Start";
2178
    short_name: "ID_Compat_Math_Start";
2179
    ident: IdCompatMathStart;
2180
    data_marker: crate::provider::PropertyBinaryIdCompatMathStartV1;
2181
    singleton: SINGLETON_PROPERTY_BINARY_ID_COMPAT_MATH_START_V1;
2182
    /// `ID_Compat_Math_Start` Property
2183
}
2184
2185
make_binary_property! {
2186
    name: "ID_Continue";
2187
    short_name: "IDC";
2188
    ident: IdContinue;
2189
    data_marker: crate::provider::PropertyBinaryIdContinueV1;
2190
    singleton: SINGLETON_PROPERTY_BINARY_ID_CONTINUE_V1;
2191
    /// Characters that can come after the first character in an identifier.
2192
    ///
2193
    /// If using NFKC to
2194
    /// fold differences between characters, use [`XidContinue`] instead.  See
2195
    /// [`Unicode Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for
2196
    /// more details.
2197
    ///
2198
    /// # Example
2199
    ///
2200
    /// ```
2201
    /// use icu::properties::CodePointSetData;
2202
    /// use icu::properties::props::IdContinue;
2203
    ///
2204
    /// let id_continue = CodePointSetData::new::<IdContinue>();
2205
    ///
2206
    /// assert!(id_continue.contains('x'));
2207
    /// assert!(id_continue.contains('1'));
2208
    /// assert!(id_continue.contains('_'));
2209
    /// assert!(id_continue.contains('ߝ'));  // U+07DD NKO LETTER FA
2210
    /// assert!(!id_continue.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
2211
    /// assert!(id_continue.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
2212
    /// ```
2213
}
2214
2215
make_binary_property! {
2216
    name: "Ideographic";
2217
    short_name: "Ideo";
2218
    ident: Ideographic;
2219
    data_marker: crate::provider::PropertyBinaryIdeographicV1;
2220
    singleton: SINGLETON_PROPERTY_BINARY_IDEOGRAPHIC_V1;
2221
    /// Characters considered to be CJKV (Chinese, Japanese, Korean, and Vietnamese)
2222
    /// ideographs, or related siniform ideographs
2223
    ///
2224
    /// # Example
2225
    ///
2226
    /// ```
2227
    /// use icu::properties::CodePointSetData;
2228
    /// use icu::properties::props::Ideographic;
2229
    ///
2230
    /// let ideographic = CodePointSetData::new::<Ideographic>();
2231
    ///
2232
    /// assert!(ideographic.contains('川'));  // U+5DDD CJK UNIFIED IDEOGRAPH-5DDD
2233
    /// assert!(!ideographic.contains('밥'));  // U+BC25 HANGUL SYLLABLE BAB
2234
    /// ```
2235
}
2236
2237
make_binary_property! {
2238
    name: "ID_Start";
2239
    short_name: "IDS";
2240
    ident: IdStart;
2241
    data_marker: crate::provider::PropertyBinaryIdStartV1;
2242
    singleton: SINGLETON_PROPERTY_BINARY_ID_START_V1;
2243
    /// Characters that can begin an identifier.
2244
    ///
2245
    /// If using NFKC to fold differences between
2246
    /// characters, use [`XidStart`] instead.  See [`Unicode Standard Annex
2247
    /// #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more details.
2248
    ///
2249
    /// # Example
2250
    ///
2251
    /// ```
2252
    /// use icu::properties::CodePointSetData;
2253
    /// use icu::properties::props::IdStart;
2254
    ///
2255
    /// let id_start = CodePointSetData::new::<IdStart>();
2256
    ///
2257
    /// assert!(id_start.contains('x'));
2258
    /// assert!(!id_start.contains('1'));
2259
    /// assert!(!id_start.contains('_'));
2260
    /// assert!(id_start.contains('ߝ'));  // U+07DD NKO LETTER FA
2261
    /// assert!(!id_start.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
2262
    /// assert!(id_start.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
2263
    /// ```
2264
}
2265
2266
make_binary_property! {
2267
    name: "IDS_Binary_Operator";
2268
    short_name: "IDSB";
2269
    ident: IdsBinaryOperator;
2270
    data_marker: crate::provider::PropertyBinaryIdsBinaryOperatorV1;
2271
    singleton: SINGLETON_PROPERTY_BINARY_IDS_BINARY_OPERATOR_V1;
2272
    /// Characters used in Ideographic Description Sequences.
2273
    ///
2274
    /// # Example
2275
    ///
2276
    /// ```
2277
    /// use icu::properties::CodePointSetData;
2278
    /// use icu::properties::props::IdsBinaryOperator;
2279
    ///
2280
    /// let ids_binary_operator = CodePointSetData::new::<IdsBinaryOperator>();
2281
    ///
2282
    /// assert!(ids_binary_operator.contains('\u{2FF5}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE
2283
    /// assert!(!ids_binary_operator.contains('\u{3006}'));  // IDEOGRAPHIC CLOSING MARK
2284
    /// ```
2285
}
2286
2287
make_binary_property! {
2288
    name: "IDS_Trinary_Operator";
2289
    short_name: "IDST";
2290
    ident: IdsTrinaryOperator;
2291
    data_marker: crate::provider::PropertyBinaryIdsTrinaryOperatorV1;
2292
    singleton: SINGLETON_PROPERTY_BINARY_IDS_TRINARY_OPERATOR_V1;
2293
    /// Characters used in Ideographic Description Sequences.
2294
    ///
2295
    /// # Example
2296
    ///
2297
    /// ```
2298
    /// use icu::properties::CodePointSetData;
2299
    /// use icu::properties::props::IdsTrinaryOperator;
2300
    ///
2301
    /// let ids_trinary_operator = CodePointSetData::new::<IdsTrinaryOperator>();
2302
    ///
2303
    /// assert!(ids_trinary_operator.contains('\u{2FF2}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER LEFT TO MIDDLE AND RIGHT
2304
    /// assert!(ids_trinary_operator.contains('\u{2FF3}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER ABOVE TO MIDDLE AND BELOW
2305
    /// assert!(!ids_trinary_operator.contains('\u{2FF4}'));
2306
    /// assert!(!ids_trinary_operator.contains('\u{2FF5}'));  // IDEOGRAPHIC DESCRIPTION CHARACTER SURROUND FROM ABOVE
2307
    /// assert!(!ids_trinary_operator.contains('\u{3006}'));  // IDEOGRAPHIC CLOSING MARK
2308
    /// ```
2309
}
2310
2311
make_binary_property! {
2312
    name: "IDS_Unary_Operator";
2313
    short_name: "IDSU";
2314
    ident: IdsUnaryOperator;
2315
    data_marker: crate::provider::PropertyBinaryIdsUnaryOperatorV1;
2316
    singleton: SINGLETON_PROPERTY_BINARY_IDS_UNARY_OPERATOR_V1;
2317
    /// `IDS_Unary_Operator` Property
2318
}
2319
2320
make_binary_property! {
2321
    name: "Join_Control";
2322
    short_name: "Join_C";
2323
    ident: JoinControl;
2324
    data_marker: crate::provider::PropertyBinaryJoinControlV1;
2325
    singleton: SINGLETON_PROPERTY_BINARY_JOIN_CONTROL_V1;
2326
    /// Format control characters which have specific functions for control of cursive joining
2327
    /// and ligation.
2328
    ///
2329
    /// # Example
2330
    ///
2331
    /// ```
2332
    /// use icu::properties::CodePointSetData;
2333
    /// use icu::properties::props::JoinControl;
2334
    ///
2335
    /// let join_control = CodePointSetData::new::<JoinControl>();
2336
    ///
2337
    /// assert!(join_control.contains('\u{200C}'));  // ZERO WIDTH NON-JOINER
2338
    /// assert!(join_control.contains('\u{200D}'));  // ZERO WIDTH JOINER
2339
    /// assert!(!join_control.contains('\u{200E}'));
2340
    /// ```
2341
}
2342
2343
make_binary_property! {
2344
    name: "Logical_Order_Exception";
2345
    short_name: "LOE";
2346
    ident: LogicalOrderException;
2347
    data_marker: crate::provider::PropertyBinaryLogicalOrderExceptionV1;
2348
    singleton: SINGLETON_PROPERTY_BINARY_LOGICAL_ORDER_EXCEPTION_V1;
2349
    /// A small number of spacing vowel letters occurring in certain Southeast Asian scripts such as Thai and Lao.
2350
    ///
2351
    /// # Example
2352
    ///
2353
    /// ```
2354
    /// use icu::properties::CodePointSetData;
2355
    /// use icu::properties::props::LogicalOrderException;
2356
    ///
2357
    /// let logical_order_exception = CodePointSetData::new::<LogicalOrderException>();
2358
    ///
2359
    /// assert!(logical_order_exception.contains('ແ'));  // U+0EC1 LAO VOWEL SIGN EI
2360
    /// assert!(!logical_order_exception.contains('ະ'));  // U+0EB0 LAO VOWEL SIGN A
2361
    /// ```
2362
}
2363
2364
make_binary_property! {
2365
    name: "Lowercase";
2366
    short_name: "Lower";
2367
    ident: Lowercase;
2368
    data_marker: crate::provider::PropertyBinaryLowercaseV1;
2369
    singleton: SINGLETON_PROPERTY_BINARY_LOWERCASE_V1;
2370
    /// Lowercase characters.
2371
    ///
2372
    /// # Example
2373
    ///
2374
    /// ```
2375
    /// use icu::properties::CodePointSetData;
2376
    /// use icu::properties::props::Lowercase;
2377
    ///
2378
    /// let lowercase = CodePointSetData::new::<Lowercase>();
2379
    ///
2380
    /// assert!(lowercase.contains('a'));
2381
    /// assert!(!lowercase.contains('A'));
2382
    /// ```
2383
}
2384
2385
make_binary_property! {
2386
    name: "Math";
2387
    short_name: "Math";
2388
    ident: Math;
2389
    data_marker: crate::provider::PropertyBinaryMathV1;
2390
    singleton: SINGLETON_PROPERTY_BINARY_MATH_V1;
2391
    /// Characters used in mathematical notation.
2392
    ///
2393
    /// # Example
2394
    ///
2395
    /// ```
2396
    /// use icu::properties::CodePointSetData;
2397
    /// use icu::properties::props::Math;
2398
    ///
2399
    /// let math = CodePointSetData::new::<Math>();
2400
    ///
2401
    /// assert!(math.contains('='));
2402
    /// assert!(math.contains('+'));
2403
    /// assert!(!math.contains('-'));
2404
    /// assert!(math.contains('−'));  // U+2212 MINUS SIGN
2405
    /// assert!(!math.contains('/'));
2406
    /// assert!(math.contains('∕'));  // U+2215 DIVISION SLASH
2407
    /// ```
2408
}
2409
2410
make_binary_property! {
2411
    name: "Modifier_Combining_Mark";
2412
    short_name: "MCM";
2413
    ident: ModifierCombiningMark;
2414
    data_marker: crate::provider::PropertyBinaryModifierCombiningMarkV1;
2415
    singleton: SINGLETON_PROPERTY_BINARY_MODIFIER_COMBINING_MARK_V1;
2416
    /// `Modifier_Combining_Mark` Property
2417
}
2418
2419
make_binary_property! {
2420
    name: "Noncharacter_Code_Point";
2421
    short_name: "NChar";
2422
    ident: NoncharacterCodePoint;
2423
    data_marker: crate::provider::PropertyBinaryNoncharacterCodePointV1;
2424
    singleton: SINGLETON_PROPERTY_BINARY_NONCHARACTER_CODE_POINT_V1;
2425
    /// Code points permanently reserved for internal use.
2426
    ///
2427
    /// # Example
2428
    ///
2429
    /// ```
2430
    /// use icu::properties::CodePointSetData;
2431
    /// use icu::properties::props::NoncharacterCodePoint;
2432
    ///
2433
    /// let noncharacter_code_point = CodePointSetData::new::<NoncharacterCodePoint>();
2434
    ///
2435
    /// assert!(noncharacter_code_point.contains('\u{FDD0}'));
2436
    /// assert!(noncharacter_code_point.contains('\u{FFFF}'));
2437
    /// assert!(!noncharacter_code_point.contains('\u{10000}'));
2438
    /// ```
2439
}
2440
2441
make_binary_property! {
2442
    name: "NFC_Inert";
2443
    short_name: "nfcinert";
2444
    ident: NfcInert;
2445
    data_marker: crate::provider::PropertyBinaryNfcInertV1;
2446
    singleton: SINGLETON_PROPERTY_BINARY_NFC_INERT_V1;
2447
    /// Characters that are inert under NFC, i.e., they do not interact with adjacent characters.
2448
    #[deprecated(since = "2.3.0", note = "not a UCD property")]
2449
}
2450
2451
make_binary_property! {
2452
    name: "NFD_Inert";
2453
    short_name: "nfdinert";
2454
    ident: NfdInert;
2455
    data_marker: crate::provider::PropertyBinaryNfdInertV1;
2456
    singleton: SINGLETON_PROPERTY_BINARY_NFD_INERT_V1;
2457
    /// Characters that are inert under NFD, i.e., they do not interact with adjacent characters.
2458
    #[deprecated(since = "2.3.0", note = "not a UCD property")]
2459
}
2460
2461
make_binary_property! {
2462
    name: "NFKC_Inert";
2463
    short_name: "nfkcinert";
2464
    ident: NfkcInert;
2465
    data_marker: crate::provider::PropertyBinaryNfkcInertV1;
2466
    singleton: SINGLETON_PROPERTY_BINARY_NFKC_INERT_V1;
2467
    /// Characters that are inert under NFKC, i.e., they do not interact with adjacent characters.
2468
    #[deprecated(since = "2.3.0", note = "not a UCD property")]
2469
}
2470
2471
make_binary_property! {
2472
    name: "NFKD_Inert";
2473
    short_name: "nfkdinert";
2474
    ident: NfkdInert;
2475
    data_marker: crate::provider::PropertyBinaryNfkdInertV1;
2476
    singleton: SINGLETON_PROPERTY_BINARY_NFKD_INERT_V1;
2477
    /// Characters that are inert under NFKD, i.e., they do not interact with adjacent characters.
2478
    #[deprecated(since = "2.3.0", note = "not a UCD property")]
2479
}
2480
2481
make_binary_property! {
2482
    name: "Pattern_Syntax";
2483
    short_name: "Pat_Syn";
2484
    ident: PatternSyntax;
2485
    data_marker: crate::provider::PropertyBinaryPatternSyntaxV1;
2486
    singleton: SINGLETON_PROPERTY_BINARY_PATTERN_SYNTAX_V1;
2487
    /// Characters used as syntax in patterns (such as regular expressions).
2488
    ///
2489
    /// See [`Unicode
2490
    /// Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more
2491
    /// details.
2492
    ///
2493
    /// # Example
2494
    ///
2495
    /// ```
2496
    /// use icu::properties::CodePointSetData;
2497
    /// use icu::properties::props::PatternSyntax;
2498
    ///
2499
    /// let pattern_syntax = CodePointSetData::new::<PatternSyntax>();
2500
    ///
2501
    /// assert!(pattern_syntax.contains('{'));
2502
    /// assert!(pattern_syntax.contains('⇒'));  // U+21D2 RIGHTWARDS DOUBLE ARROW
2503
    /// assert!(!pattern_syntax.contains('0'));
2504
    /// ```
2505
}
2506
2507
make_binary_property! {
2508
    name: "Pattern_White_Space";
2509
    short_name: "Pat_WS";
2510
    ident: PatternWhiteSpace;
2511
    data_marker: crate::provider::PropertyBinaryPatternWhiteSpaceV1;
2512
    singleton: SINGLETON_PROPERTY_BINARY_PATTERN_WHITE_SPACE_V1;
2513
    /// Characters used as whitespace in patterns (such as regular expressions).
2514
    ///
2515
    /// See
2516
    /// [`Unicode Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for
2517
    /// more details.
2518
    ///
2519
    /// # Example
2520
    ///
2521
    /// ```
2522
    /// use icu::properties::CodePointSetData;
2523
    /// use icu::properties::props::PatternWhiteSpace;
2524
    ///
2525
    /// let pattern_white_space = CodePointSetData::new::<PatternWhiteSpace>();
2526
    ///
2527
    /// assert!(pattern_white_space.contains(' '));
2528
    /// assert!(pattern_white_space.contains('\u{2029}'));  // PARAGRAPH SEPARATOR
2529
    /// assert!(pattern_white_space.contains('\u{000A}'));  // NEW LINE
2530
    /// assert!(!pattern_white_space.contains('\u{00A0}'));  // NO-BREAK SPACE
2531
    /// ```
2532
}
2533
2534
make_binary_property! {
2535
    name: "Prepended_Concatenation_Mark";
2536
    short_name: "PCM";
2537
    ident: PrependedConcatenationMark;
2538
    data_marker: crate::provider::PropertyBinaryPrependedConcatenationMarkV1;
2539
    singleton: SINGLETON_PROPERTY_BINARY_PREPENDED_CONCATENATION_MARK_V1;
2540
    /// A small class of visible format controls, which precede and then span a sequence of
2541
    /// other characters, usually digits.
2542
}
2543
2544
make_binary_property! {
2545
    name: "print";
2546
    short_name: "print";
2547
    ident: Print;
2548
    data_marker: crate::provider::PropertyBinaryPrintV1;
2549
    singleton: SINGLETON_PROPERTY_BINARY_PRINT_V1;
2550
    /// Printable characters (visible characters and whitespace).
2551
    ///
2552
    /// This is defined for POSIX compatibility.
2553
}
2554
2555
make_binary_property! {
2556
    name: "Quotation_Mark";
2557
    short_name: "QMark";
2558
    ident: QuotationMark;
2559
    data_marker: crate::provider::PropertyBinaryQuotationMarkV1;
2560
    singleton: SINGLETON_PROPERTY_BINARY_QUOTATION_MARK_V1;
2561
    /// Punctuation characters that function as quotation marks.
2562
    ///
2563
    /// # Example
2564
    ///
2565
    /// ```
2566
    /// use icu::properties::CodePointSetData;
2567
    /// use icu::properties::props::QuotationMark;
2568
    ///
2569
    /// let quotation_mark = CodePointSetData::new::<QuotationMark>();
2570
    ///
2571
    /// assert!(quotation_mark.contains('\''));
2572
    /// assert!(quotation_mark.contains('„'));  // U+201E DOUBLE LOW-9 QUOTATION MARK
2573
    /// assert!(!quotation_mark.contains('<'));
2574
    /// ```
2575
}
2576
2577
make_binary_property! {
2578
    name: "Radical";
2579
    short_name: "Radical";
2580
    ident: Radical;
2581
    data_marker: crate::provider::PropertyBinaryRadicalV1;
2582
    singleton: SINGLETON_PROPERTY_BINARY_RADICAL_V1;
2583
    /// Characters used in the definition of Ideographic Description Sequences.
2584
    ///
2585
    /// # Example
2586
    ///
2587
    /// ```
2588
    /// use icu::properties::CodePointSetData;
2589
    /// use icu::properties::props::Radical;
2590
    ///
2591
    /// let radical = CodePointSetData::new::<Radical>();
2592
    ///
2593
    /// assert!(radical.contains('⺆'));  // U+2E86 CJK RADICAL BOX
2594
    /// assert!(!radical.contains('丹'));  // U+F95E CJK COMPATIBILITY IDEOGRAPH-F95E
2595
    /// ```
2596
}
2597
2598
make_binary_property! {
2599
    name: "Regional_Indicator";
2600
    short_name: "RI";
2601
    ident: RegionalIndicator;
2602
    data_marker: crate::provider::PropertyBinaryRegionalIndicatorV1;
2603
    singleton: SINGLETON_PROPERTY_BINARY_REGIONAL_INDICATOR_V1;
2604
    /// Regional indicator characters, `U+1F1E6..U+1F1FF`.
2605
    ///
2606
    /// # Example
2607
    ///
2608
    /// ```
2609
    /// use icu::properties::CodePointSetData;
2610
    /// use icu::properties::props::RegionalIndicator;
2611
    ///
2612
    /// let regional_indicator = CodePointSetData::new::<RegionalIndicator>();
2613
    ///
2614
    /// assert!(regional_indicator.contains('🇹'));  // U+1F1F9 REGIONAL INDICATOR SYMBOL LETTER T
2615
    /// assert!(!regional_indicator.contains('Ⓣ'));  // U+24C9 CIRCLED LATIN CAPITAL LETTER T
2616
    /// assert!(!regional_indicator.contains('T'));
2617
    /// ```
2618
}
2619
2620
make_binary_property! {
2621
    name: "Soft_Dotted";
2622
    short_name: "SD";
2623
    ident: SoftDotted;
2624
    data_marker: crate::provider::PropertyBinarySoftDottedV1;
2625
    singleton: SINGLETON_PROPERTY_BINARY_SOFT_DOTTED_V1;
2626
    /// Characters with a "soft dot", like i or j.
2627
    ///
2628
    /// An accent placed on these characters causes
2629
    /// the dot to disappear.
2630
    ///
2631
    /// # Example
2632
    ///
2633
    /// ```
2634
    /// use icu::properties::CodePointSetData;
2635
    /// use icu::properties::props::SoftDotted;
2636
    ///
2637
    /// let soft_dotted = CodePointSetData::new::<SoftDotted>();
2638
    ///
2639
    /// assert!(soft_dotted.contains('і'));  //U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
2640
    /// assert!(!soft_dotted.contains('ı'));  // U+0131 LATIN SMALL LETTER DOTLESS I
2641
    /// ```
2642
}
2643
2644
make_binary_property! {
2645
    name: "Segment_Starter";
2646
    short_name: "segstart";
2647
    ident: SegmentStarter;
2648
    data_marker: crate::provider::PropertyBinarySegmentStarterV1;
2649
    singleton: SINGLETON_PROPERTY_BINARY_SEGMENT_STARTER_V1;
2650
    /// Characters that are starters in terms of Unicode normalization and combining character
2651
    /// sequences.
2652
    #[deprecated(since = "2.3.0", note = "not a UCD property")]
2653
}
2654
2655
make_binary_property! {
2656
    name: "Case_Sensitive";
2657
    short_name: "Sensitive";
2658
    ident: CaseSensitive;
2659
    data_marker: crate::provider::PropertyBinaryCaseSensitiveV1;
2660
    singleton: SINGLETON_PROPERTY_BINARY_CASE_SENSITIVE_V1;
2661
    /// Characters that are either the source of a case mapping or in the target of a case
2662
    /// mapping.
2663
    #[deprecated(since = "2.3.0", note = "not a UCD property")]
2664
}
2665
2666
make_binary_property! {
2667
    name: "Sentence_Terminal";
2668
    short_name: "STerm";
2669
    ident: SentenceTerminal;
2670
    data_marker: crate::provider::PropertyBinarySentenceTerminalV1;
2671
    singleton: SINGLETON_PROPERTY_BINARY_SENTENCE_TERMINAL_V1;
2672
    /// Punctuation characters that generally mark the end of sentences.
2673
    ///
2674
    /// # Example
2675
    ///
2676
    /// ```
2677
    /// use icu::properties::CodePointSetData;
2678
    /// use icu::properties::props::SentenceTerminal;
2679
    ///
2680
    /// let sentence_terminal = CodePointSetData::new::<SentenceTerminal>();
2681
    ///
2682
    /// assert!(sentence_terminal.contains('.'));
2683
    /// assert!(sentence_terminal.contains('?'));
2684
    /// assert!(sentence_terminal.contains('᪨'));  // U+1AA8 TAI THAM SIGN KAAN
2685
    /// assert!(!sentence_terminal.contains(','));
2686
    /// assert!(!sentence_terminal.contains('¿'));  // U+00BF INVERTED QUESTION MARK
2687
    /// ```
2688
}
2689
2690
make_binary_property! {
2691
    name: "Terminal_Punctuation";
2692
    short_name: "Term";
2693
    ident: TerminalPunctuation;
2694
    data_marker: crate::provider::PropertyBinaryTerminalPunctuationV1;
2695
    singleton: SINGLETON_PROPERTY_BINARY_TERMINAL_PUNCTUATION_V1;
2696
    /// Punctuation characters that generally mark the end of textual units.
2697
    ///
2698
    /// # Example
2699
    ///
2700
    /// ```
2701
    /// use icu::properties::CodePointSetData;
2702
    /// use icu::properties::props::TerminalPunctuation;
2703
    ///
2704
    /// let terminal_punctuation = CodePointSetData::new::<TerminalPunctuation>();
2705
    ///
2706
    /// assert!(terminal_punctuation.contains('.'));
2707
    /// assert!(terminal_punctuation.contains('?'));
2708
    /// assert!(terminal_punctuation.contains('᪨'));  // U+1AA8 TAI THAM SIGN KAAN
2709
    /// assert!(terminal_punctuation.contains(','));
2710
    /// assert!(!terminal_punctuation.contains('¿'));  // U+00BF INVERTED QUESTION MARK
2711
    /// ```
2712
}
2713
2714
make_binary_property! {
2715
    name: "Unified_Ideograph";
2716
    short_name: "UIdeo";
2717
    ident: UnifiedIdeograph;
2718
    data_marker: crate::provider::PropertyBinaryUnifiedIdeographV1;
2719
    singleton: SINGLETON_PROPERTY_BINARY_UNIFIED_IDEOGRAPH_V1;
2720
    /// A property which specifies the exact set of Unified CJK Ideographs in the standard.
2721
    ///
2722
    /// # Example
2723
    ///
2724
    /// ```
2725
    /// use icu::properties::CodePointSetData;
2726
    /// use icu::properties::props::UnifiedIdeograph;
2727
    ///
2728
    /// let unified_ideograph = CodePointSetData::new::<UnifiedIdeograph>();
2729
    ///
2730
    /// assert!(unified_ideograph.contains('川'));  // U+5DDD CJK UNIFIED IDEOGRAPH-5DDD
2731
    /// assert!(unified_ideograph.contains('木'));  // U+6728 CJK UNIFIED IDEOGRAPH-6728
2732
    /// assert!(!unified_ideograph.contains('𛅸'));  // U+1B178 NUSHU CHARACTER-1B178
2733
    /// ```
2734
}
2735
2736
make_binary_property! {
2737
    name: "Uppercase";
2738
    short_name: "Upper";
2739
    ident: Uppercase;
2740
    data_marker: crate::provider::PropertyBinaryUppercaseV1;
2741
    singleton: SINGLETON_PROPERTY_BINARY_UPPERCASE_V1;
2742
    /// Uppercase characters.
2743
    ///
2744
    /// # Example
2745
    ///
2746
    /// ```
2747
    /// use icu::properties::CodePointSetData;
2748
    /// use icu::properties::props::Uppercase;
2749
    ///
2750
    /// let uppercase = CodePointSetData::new::<Uppercase>();
2751
    ///
2752
    /// assert!(uppercase.contains('U'));
2753
    /// assert!(!uppercase.contains('u'));
2754
    /// ```
2755
}
2756
2757
make_binary_property! {
2758
    name: "Variation_Selector";
2759
    short_name: "VS";
2760
    ident: VariationSelector;
2761
    data_marker: crate::provider::PropertyBinaryVariationSelectorV1;
2762
    singleton: SINGLETON_PROPERTY_BINARY_VARIATION_SELECTOR_V1;
2763
    /// Characters that are Variation Selectors.
2764
    ///
2765
    /// # Example
2766
    ///
2767
    /// ```
2768
    /// use icu::properties::CodePointSetData;
2769
    /// use icu::properties::props::VariationSelector;
2770
    ///
2771
    /// let variation_selector = CodePointSetData::new::<VariationSelector>();
2772
    ///
2773
    /// assert!(variation_selector.contains('\u{180D}'));  // MONGOLIAN FREE VARIATION SELECTOR THREE
2774
    /// assert!(!variation_selector.contains('\u{303E}'));  // IDEOGRAPHIC VARIATION INDICATOR
2775
    /// assert!(variation_selector.contains('\u{FE0F}'));  // VARIATION SELECTOR-16
2776
    /// assert!(!variation_selector.contains('\u{FE10}'));  // PRESENTATION FORM FOR VERTICAL COMMA
2777
    /// assert!(variation_selector.contains('\u{E01EF}'));  // VARIATION SELECTOR-256
2778
    /// ```
2779
}
2780
2781
make_binary_property! {
2782
    name: "White_Space";
2783
    short_name: "WSpace";
2784
    ident: WhiteSpace;
2785
    data_marker: crate::provider::PropertyBinaryWhiteSpaceV1;
2786
    singleton: SINGLETON_PROPERTY_BINARY_WHITE_SPACE_V1;
2787
    /// Spaces, separator characters and other control characters which should be treated by
2788
    /// programming languages as "white space" for the purpose of parsing elements.
2789
    ///
2790
    /// # Example
2791
    ///
2792
    /// ```
2793
    /// use icu::properties::CodePointSetData;
2794
    /// use icu::properties::props::WhiteSpace;
2795
    ///
2796
    /// let white_space = CodePointSetData::new::<WhiteSpace>();
2797
    ///
2798
    /// assert!(white_space.contains(' '));
2799
    /// assert!(white_space.contains('\u{000A}'));  // NEW LINE
2800
    /// assert!(white_space.contains('\u{00A0}'));  // NO-BREAK SPACE
2801
    /// assert!(!white_space.contains('\u{200B}'));  // ZERO WIDTH SPACE
2802
    /// ```
2803
}
2804
2805
make_binary_property! {
2806
    name: "xdigit";
2807
    short_name: "xdigit";
2808
    ident: Xdigit;
2809
    data_marker: crate::provider::PropertyBinaryXdigitV1;
2810
    singleton: SINGLETON_PROPERTY_BINARY_XDIGIT_V1;
2811
    /// Hexadecimal digits
2812
    ///
2813
    /// This is defined for POSIX compatibility.
2814
}
2815
2816
make_binary_property! {
2817
    name: "XID_Continue";
2818
    short_name: "XIDC";
2819
    ident: XidContinue;
2820
    data_marker: crate::provider::PropertyBinaryXidContinueV1;
2821
    singleton: SINGLETON_PROPERTY_BINARY_XID_CONTINUE_V1;
2822
    /// Characters that can come after the first character in an identifier.
2823
    ///
2824
    /// See [`Unicode Standard Annex
2825
    /// #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more details.
2826
    ///
2827
    /// # Example
2828
    ///
2829
    /// ```
2830
    /// use icu::properties::CodePointSetData;
2831
    /// use icu::properties::props::XidContinue;
2832
    ///
2833
    /// let xid_continue = CodePointSetData::new::<XidContinue>();
2834
    ///
2835
    /// assert!(xid_continue.contains('x'));
2836
    /// assert!(xid_continue.contains('1'));
2837
    /// assert!(xid_continue.contains('_'));
2838
    /// assert!(xid_continue.contains('ߝ'));  // U+07DD NKO LETTER FA
2839
    /// assert!(!xid_continue.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
2840
    /// assert!(!xid_continue.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
2841
    /// ```
2842
}
2843
2844
make_binary_property! {
2845
    name: "XID_Start";
2846
    short_name: "XIDS";
2847
    ident: XidStart;
2848
    data_marker: crate::provider::PropertyBinaryXidStartV1;
2849
    singleton: SINGLETON_PROPERTY_BINARY_XID_START_V1;
2850
    /// Characters that can begin an identifier.
2851
    ///
2852
    /// See [`Unicode
2853
    /// Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more
2854
    /// details.
2855
    ///
2856
    /// # Example
2857
    ///
2858
    /// ```
2859
    /// use icu::properties::CodePointSetData;
2860
    /// use icu::properties::props::XidStart;
2861
    ///
2862
    /// let xid_start = CodePointSetData::new::<XidStart>();
2863
    ///
2864
    /// assert!(xid_start.contains('x'));
2865
    /// assert!(!xid_start.contains('1'));
2866
    /// assert!(!xid_start.contains('_'));
2867
    /// assert!(xid_start.contains('ߝ'));  // U+07DD NKO LETTER FA
2868
    /// assert!(!xid_start.contains('ⓧ'));  // U+24E7 CIRCLED LATIN SMALL LETTER X
2869
    /// assert!(!xid_start.contains('\u{FC5E}'));  // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
2870
    /// ```
2871
}
2872
2873
pub use crate::emoji::EmojiSet;
2874
2875
macro_rules! make_emoji_set {
2876
    (
2877
        name: $name:literal;
2878
        short_name: $short_name:literal;
2879
        ident: $ident:ident;
2880
        data_marker: $data_marker:ty;
2881
        singleton: $singleton:ident;
2882
        $(#[$doc:meta])+
2883
    ) => {
2884
        $(#[$doc])+
2885
        #[derive(Debug)]
2886
        #[non_exhaustive]
2887
        pub struct $ident;
2888
2889
        impl crate::private::Sealed for $ident {}
2890
2891
        impl EmojiSet for $ident {
2892
            type DataMarker = $data_marker;
2893
            #[cfg(feature = "compiled_data")]
2894
            const SINGLETON: &'static crate::provider::PropertyUnicodeSet<'static> =
2895
                &crate::provider::Baked::$singleton;
2896
            const NAME: &'static [u8] = $name.as_bytes();
2897
            const SHORT_NAME: &'static [u8] = $short_name.as_bytes();
2898
        }
2899
    }
2900
}
2901
2902
make_emoji_set! {
2903
    name: "Basic_Emoji";
2904
    short_name: "Basic_Emoji";
2905
    ident: BasicEmoji;
2906
    data_marker: crate::provider::PropertyBinaryBasicEmojiV1;
2907
    singleton: SINGLETON_PROPERTY_BINARY_BASIC_EMOJI_V1;
2908
    /// Characters and character sequences intended for general-purpose, independent, direct input.
2909
    ///
2910
    /// See [`Unicode Technical Standard #51`](https://unicode.org/reports/tr51/) for more
2911
    /// details.
2912
    ///
2913
    /// # Example
2914
    ///
2915
    /// ```
2916
    /// use icu::properties::EmojiSetData;
2917
    /// use icu::properties::props::BasicEmoji;
2918
    ///
2919
    /// let basic_emoji = EmojiSetData::new::<BasicEmoji>();
2920
    ///
2921
    /// assert!(!basic_emoji.contains('\u{0020}'));
2922
    /// assert!(!basic_emoji.contains('\n'));
2923
    /// assert!(basic_emoji.contains('🦃')); // U+1F983 TURKEY
2924
    /// assert!(basic_emoji.contains_str("\u{1F983}"));
2925
    /// assert!(basic_emoji.contains_str("\u{1F6E4}\u{FE0F}")); // railway track
2926
    /// assert!(!basic_emoji.contains_str("\u{0033}\u{FE0F}\u{20E3}"));  // Emoji_Keycap_Sequence, keycap 3
2927
    /// ```
2928
}