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