Skip to main content

icu_properties/
provider.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// Provider structs must be stable
6#![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)]
7
8//! 🚧 \[Unstable\] Data provider struct definitions for this ICU4X component.
9//!
10//! <div class="stab unstable">
11//! 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
12//! including in SemVer minor releases. While the serde representation of data structs is guaranteed
13//! to be stable, their Rust representation might not be. Use with caution.
14//! </div>
15//!
16//! Read more about data providers: [`icu_provider`]
17
18pub mod names;
19
20#[cfg(feature = "alloc")]
21pub use names::{
22    PropertyNameLongCanonicalCombiningClassV1, PropertyNameShortCanonicalCombiningClassV1,
23};
24
25pub use names::{
26    PropertyNameLongBidiClassV1, PropertyNameLongBlockV1, PropertyNameLongEastAsianWidthV1,
27    PropertyNameLongGeneralCategoryV1, PropertyNameLongGraphemeClusterBreakV1,
28    PropertyNameLongHangulSyllableTypeV1, PropertyNameLongIndicConjunctBreakV1,
29    PropertyNameLongIndicSyllabicCategoryV1, PropertyNameLongJoiningGroupV1,
30    PropertyNameLongJoiningTypeV1, PropertyNameLongLineBreakV1, PropertyNameLongNumericTypeV1,
31    PropertyNameLongScriptV1, PropertyNameLongSentenceBreakV1,
32    PropertyNameLongVerticalOrientationV1, PropertyNameLongWordBreakV1,
33    PropertyNameParseBidiClassV1, PropertyNameParseBlockV1,
34    PropertyNameParseCanonicalCombiningClassV1, PropertyNameParseEastAsianWidthV1,
35    PropertyNameParseGeneralCategoryMaskV1, PropertyNameParseGeneralCategoryV1,
36    PropertyNameParseGraphemeClusterBreakV1, PropertyNameParseHangulSyllableTypeV1,
37    PropertyNameParseIndicConjunctBreakV1, PropertyNameParseIndicSyllabicCategoryV1,
38    PropertyNameParseJoiningGroupV1, PropertyNameParseJoiningTypeV1, PropertyNameParseLineBreakV1,
39    PropertyNameParseNumericTypeV1, PropertyNameParseScriptV1, PropertyNameParseSentenceBreakV1,
40    PropertyNameParseVerticalOrientationV1, PropertyNameParseWordBreakV1,
41    PropertyNameShortBidiClassV1, PropertyNameShortBlockV1, PropertyNameShortEastAsianWidthV1,
42    PropertyNameShortGeneralCategoryV1, PropertyNameShortGraphemeClusterBreakV1,
43    PropertyNameShortHangulSyllableTypeV1, PropertyNameShortIndicConjunctBreakV1,
44    PropertyNameShortIndicSyllabicCategoryV1, PropertyNameShortJoiningGroupV1,
45    PropertyNameShortJoiningTypeV1, PropertyNameShortLineBreakV1, PropertyNameShortNumericTypeV1,
46    PropertyNameShortScriptV1, PropertyNameShortSentenceBreakV1,
47    PropertyNameShortVerticalOrientationV1, PropertyNameShortWordBreakV1,
48};
49
50pub use crate::enum_values::GeneralCategoryULE;
51use crate::props::*;
52use crate::script::ScriptWithExt;
53use core::ops::RangeInclusive;
54use icu_collections::codepointinvlist::CodePointInversionList;
55use icu_collections::codepointinvliststringlist::CodePointInversionListAndStringList;
56use icu_collections::codepointtrie::{CodePointMapRange, CodePointTrie, TrieValue};
57use icu_provider::prelude::*;
58use zerofrom::ZeroFrom;
59use zerovec::{VarZeroVec, ZeroSlice};
60
61#[cfg(feature = "compiled_data")]
62#[derive(Debug)]
63/// Baked data
64///
65/// <div class="stab unstable">
66/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
67/// including in SemVer minor releases. In particular, the `DataProvider` implementations are only
68/// guaranteed to match with this version's `*_unstable` providers. Use with caution.
69/// </div>
70pub struct Baked;
71
72#[cfg(feature = "compiled_data")]
73#[allow(unused_imports)]
74const _: () = {
75    use icu_properties_data::*;
76    pub mod icu {
77        pub use crate as properties;
78        pub use icu_collections as collections;
79    }
80    make_provider!(Baked);
81    impl_property_binary_alnum_v1!(Baked);
82    impl_property_binary_alphabetic_v1!(Baked);
83    impl_property_binary_ascii_hex_digit_v1!(Baked);
84    impl_property_binary_basic_emoji_v1!(Baked);
85    impl_property_binary_bidi_control_v1!(Baked);
86    impl_property_binary_bidi_mirrored_v1!(Baked);
87    impl_property_binary_blank_v1!(Baked);
88    impl_property_binary_case_ignorable_v1!(Baked);
89    impl_property_binary_case_sensitive_v1!(Baked);
90    impl_property_binary_cased_v1!(Baked);
91    impl_property_binary_changes_when_casefolded_v1!(Baked);
92    impl_property_binary_changes_when_casemapped_v1!(Baked);
93    impl_property_binary_changes_when_lowercased_v1!(Baked);
94    impl_property_binary_changes_when_nfkc_casefolded_v1!(Baked);
95    impl_property_binary_changes_when_titlecased_v1!(Baked);
96    impl_property_binary_changes_when_uppercased_v1!(Baked);
97    impl_property_binary_dash_v1!(Baked);
98    impl_property_binary_default_ignorable_code_point_v1!(Baked);
99    impl_property_binary_deprecated_v1!(Baked);
100    impl_property_binary_diacritic_v1!(Baked);
101    impl_property_binary_emoji_component_v1!(Baked);
102    impl_property_binary_emoji_modifier_base_v1!(Baked);
103    impl_property_binary_emoji_modifier_v1!(Baked);
104    impl_property_binary_emoji_presentation_v1!(Baked);
105    impl_property_binary_emoji_v1!(Baked);
106    impl_property_binary_extended_pictographic_v1!(Baked);
107    impl_property_binary_extender_v1!(Baked);
108    impl_property_binary_full_composition_exclusion_v1!(Baked);
109    impl_property_binary_graph_v1!(Baked);
110    impl_property_binary_grapheme_base_v1!(Baked);
111    impl_property_binary_grapheme_extend_v1!(Baked);
112    impl_property_binary_grapheme_link_v1!(Baked);
113    impl_property_binary_hex_digit_v1!(Baked);
114    impl_property_binary_hyphen_v1!(Baked);
115    impl_property_binary_id_compat_math_continue_v1!(Baked);
116    impl_property_binary_id_compat_math_start_v1!(Baked);
117    impl_property_binary_id_continue_v1!(Baked);
118    impl_property_binary_id_start_v1!(Baked);
119    impl_property_binary_ideographic_v1!(Baked);
120    impl_property_binary_ids_binary_operator_v1!(Baked);
121    impl_property_binary_ids_trinary_operator_v1!(Baked);
122    impl_property_binary_ids_unary_operator_v1!(Baked);
123    impl_property_binary_join_control_v1!(Baked);
124    impl_property_binary_logical_order_exception_v1!(Baked);
125    impl_property_binary_lowercase_v1!(Baked);
126    impl_property_binary_math_v1!(Baked);
127    impl_property_binary_modifier_combining_mark_v1!(Baked);
128    impl_property_binary_nfc_inert_v1!(Baked);
129    impl_property_binary_nfd_inert_v1!(Baked);
130    impl_property_binary_nfkc_inert_v1!(Baked);
131    impl_property_binary_nfkd_inert_v1!(Baked);
132    impl_property_binary_noncharacter_code_point_v1!(Baked);
133    impl_property_binary_pattern_syntax_v1!(Baked);
134    impl_property_binary_pattern_white_space_v1!(Baked);
135    impl_property_binary_prepended_concatenation_mark_v1!(Baked);
136    impl_property_binary_print_v1!(Baked);
137    impl_property_binary_quotation_mark_v1!(Baked);
138    impl_property_binary_radical_v1!(Baked);
139    impl_property_binary_regional_indicator_v1!(Baked);
140    impl_property_binary_segment_starter_v1!(Baked);
141    impl_property_binary_sentence_terminal_v1!(Baked);
142    impl_property_binary_soft_dotted_v1!(Baked);
143    impl_property_binary_terminal_punctuation_v1!(Baked);
144    impl_property_binary_unified_ideograph_v1!(Baked);
145    impl_property_binary_uppercase_v1!(Baked);
146    impl_property_binary_variation_selector_v1!(Baked);
147    impl_property_binary_white_space_v1!(Baked);
148    impl_property_binary_xdigit_v1!(Baked);
149    impl_property_binary_xid_continue_v1!(Baked);
150    impl_property_binary_xid_start_v1!(Baked);
151    impl_property_enum_bidi_class_v1!(Baked);
152    impl_property_enum_block_v1!(Baked);
153    impl_property_enum_bidi_mirroring_glyph_v1!(Baked);
154    impl_property_enum_canonical_combining_class_v1!(Baked);
155    impl_property_enum_east_asian_width_v1!(Baked);
156    impl_property_enum_general_category_v1!(Baked);
157    impl_property_enum_grapheme_cluster_break_v1!(Baked);
158    impl_property_enum_hangul_syllable_type_v1!(Baked);
159    impl_property_enum_indic_conjunct_break_v1!(Baked);
160    impl_property_enum_indic_syllabic_category_v1!(Baked);
161    impl_property_enum_joining_group_v1!(Baked);
162    impl_property_enum_joining_type_v1!(Baked);
163    impl_property_enum_line_break_v1!(Baked);
164    impl_property_enum_numeric_type_v1!(Baked);
165    impl_property_enum_script_v1!(Baked);
166    impl_property_enum_sentence_break_v1!(Baked);
167    impl_property_enum_vertical_orientation_v1!(Baked);
168    impl_property_enum_word_break_v1!(Baked);
169    impl_property_name_long_bidi_class_v1!(Baked);
170    impl_property_name_long_block_v1!(Baked);
171    #[cfg(feature = "alloc")]
172    impl_property_name_long_canonical_combining_class_v1!(Baked);
173    impl_property_name_long_east_asian_width_v1!(Baked);
174    impl_property_name_long_general_category_v1!(Baked);
175    impl_property_name_long_grapheme_cluster_break_v1!(Baked);
176    impl_property_name_long_hangul_syllable_type_v1!(Baked);
177    impl_property_name_long_indic_syllabic_category_v1!(Baked);
178    impl_property_name_long_indic_conjunct_break_v1!(Baked);
179    impl_property_name_long_joining_group_v1!(Baked);
180    impl_property_name_long_joining_type_v1!(Baked);
181    impl_property_name_long_line_break_v1!(Baked);
182    impl_property_name_long_numeric_type_v1!(Baked);
183    impl_property_name_long_script_v1!(Baked);
184    impl_property_name_long_sentence_break_v1!(Baked);
185    impl_property_name_long_vertical_orientation_v1!(Baked);
186    impl_property_name_long_word_break_v1!(Baked);
187    impl_property_name_parse_bidi_class_v1!(Baked);
188    impl_property_name_parse_block_v1!(Baked);
189    impl_property_name_parse_canonical_combining_class_v1!(Baked);
190    impl_property_name_parse_east_asian_width_v1!(Baked);
191    impl_property_name_parse_general_category_mask_v1!(Baked);
192    impl_property_name_parse_general_category_v1!(Baked);
193    impl_property_name_parse_grapheme_cluster_break_v1!(Baked);
194    impl_property_name_parse_hangul_syllable_type_v1!(Baked);
195    impl_property_name_parse_indic_syllabic_category_v1!(Baked);
196    impl_property_name_parse_indic_conjunct_break_v1!(Baked);
197    impl_property_name_parse_joining_group_v1!(Baked);
198    impl_property_name_parse_joining_type_v1!(Baked);
199    impl_property_name_parse_line_break_v1!(Baked);
200    impl_property_name_parse_numeric_type_v1!(Baked);
201    impl_property_name_parse_script_v1!(Baked);
202    impl_property_name_parse_sentence_break_v1!(Baked);
203    impl_property_name_parse_vertical_orientation_v1!(Baked);
204    impl_property_name_parse_word_break_v1!(Baked);
205    impl_property_name_short_bidi_class_v1!(Baked);
206    impl_property_name_short_block_v1!(Baked);
207    #[cfg(feature = "alloc")]
208    impl_property_name_short_canonical_combining_class_v1!(Baked);
209    impl_property_name_short_east_asian_width_v1!(Baked);
210    impl_property_name_short_general_category_v1!(Baked);
211    impl_property_name_short_grapheme_cluster_break_v1!(Baked);
212    impl_property_name_short_hangul_syllable_type_v1!(Baked);
213    impl_property_name_short_indic_syllabic_category_v1!(Baked);
214    impl_property_name_short_indic_conjunct_break_v1!(Baked);
215    impl_property_name_short_joining_group_v1!(Baked);
216    impl_property_name_short_joining_type_v1!(Baked);
217    impl_property_name_short_line_break_v1!(Baked);
218    impl_property_name_short_numeric_type_v1!(Baked);
219    impl_property_name_short_script_v1!(Baked);
220    impl_property_name_short_sentence_break_v1!(Baked);
221    impl_property_name_short_vertical_orientation_v1!(Baked);
222    impl_property_name_short_word_break_v1!(Baked);
223    impl_property_script_with_extensions_v1!(Baked);
224};
225
226icu_provider::data_marker!(
227    /// `PropertyBinaryAlnumV1`
228    PropertyBinaryAlnumV1,
229    PropertyCodePointSet<'static>,
230    is_singleton = true
231);
232icu_provider::data_marker!(
233    /// `PropertyBinaryAlphabeticV1`
234    PropertyBinaryAlphabeticV1,
235    PropertyCodePointSet<'static>,
236    is_singleton = true
237);
238icu_provider::data_marker!(
239    /// `PropertyBinaryAsciiHexDigitV1`
240    PropertyBinaryAsciiHexDigitV1,
241    PropertyCodePointSet<'static>,
242    is_singleton = true
243);
244icu_provider::data_marker!(
245    /// `PropertyBinaryBidiControlV1`
246    PropertyBinaryBidiControlV1,
247    PropertyCodePointSet<'static>,
248    is_singleton = true
249);
250icu_provider::data_marker!(
251    /// `PropertyBinaryBidiMirroredV1`
252    PropertyBinaryBidiMirroredV1,
253    PropertyCodePointSet<'static>,
254    is_singleton = true
255);
256icu_provider::data_marker!(
257    /// `PropertyBinaryBlankV1`
258    PropertyBinaryBlankV1,
259    PropertyCodePointSet<'static>,
260    is_singleton = true
261);
262icu_provider::data_marker!(
263    /// `PropertyBinaryCasedV1`
264    PropertyBinaryCasedV1,
265    PropertyCodePointSet<'static>,
266    is_singleton = true
267);
268icu_provider::data_marker!(
269    /// `PropertyBinaryCaseIgnorableV1`
270    PropertyBinaryCaseIgnorableV1,
271    PropertyCodePointSet<'static>,
272    is_singleton = true
273);
274icu_provider::data_marker!(
275    /// `PropertyBinaryCaseSensitiveV1`
276    PropertyBinaryCaseSensitiveV1,
277    PropertyCodePointSet<'static>,
278    is_singleton = true
279);
280icu_provider::data_marker!(
281    /// `PropertyBinaryChangesWhenCasefoldedV1`
282    PropertyBinaryChangesWhenCasefoldedV1,
283    PropertyCodePointSet<'static>,
284    is_singleton = true
285);
286icu_provider::data_marker!(
287    /// `PropertyBinaryChangesWhenCasemappedV1`
288    PropertyBinaryChangesWhenCasemappedV1,
289    PropertyCodePointSet<'static>,
290    is_singleton = true
291);
292icu_provider::data_marker!(
293    /// `PropertyBinaryChangesWhenLowercasedV1`
294    PropertyBinaryChangesWhenLowercasedV1,
295    PropertyCodePointSet<'static>,
296    is_singleton = true
297);
298icu_provider::data_marker!(
299    /// `PropertyBinaryChangesWhenNfkcCasefoldedV1`
300    PropertyBinaryChangesWhenNfkcCasefoldedV1,
301    PropertyCodePointSet<'static>,
302    is_singleton = true
303);
304icu_provider::data_marker!(
305    /// `PropertyBinaryChangesWhenTitlecasedV1`
306    PropertyBinaryChangesWhenTitlecasedV1,
307    PropertyCodePointSet<'static>,
308    is_singleton = true
309);
310icu_provider::data_marker!(
311    /// `PropertyBinaryChangesWhenUppercasedV1`
312    PropertyBinaryChangesWhenUppercasedV1,
313    PropertyCodePointSet<'static>,
314    is_singleton = true
315);
316icu_provider::data_marker!(
317    /// `PropertyBinaryDashV1`
318    PropertyBinaryDashV1,
319    PropertyCodePointSet<'static>,
320    is_singleton = true
321);
322icu_provider::data_marker!(
323    /// `PropertyBinaryDefaultIgnorableCodePointV1`
324    PropertyBinaryDefaultIgnorableCodePointV1,
325    PropertyCodePointSet<'static>,
326    is_singleton = true
327);
328icu_provider::data_marker!(
329    /// `PropertyBinaryDeprecatedV1`
330    PropertyBinaryDeprecatedV1,
331    PropertyCodePointSet<'static>,
332    is_singleton = true
333);
334icu_provider::data_marker!(
335    /// `PropertyBinaryDiacriticV1`
336    PropertyBinaryDiacriticV1,
337    PropertyCodePointSet<'static>,
338    is_singleton = true
339);
340icu_provider::data_marker!(
341    /// `PropertyBinaryEmojiComponentV1`
342    PropertyBinaryEmojiComponentV1,
343    PropertyCodePointSet<'static>,
344    is_singleton = true
345);
346icu_provider::data_marker!(
347    /// `PropertyBinaryEmojiModifierBaseV1`
348    PropertyBinaryEmojiModifierBaseV1,
349    PropertyCodePointSet<'static>,
350    is_singleton = true
351);
352icu_provider::data_marker!(
353    /// `PropertyBinaryEmojiModifierV1`
354    PropertyBinaryEmojiModifierV1,
355    PropertyCodePointSet<'static>,
356    is_singleton = true
357);
358icu_provider::data_marker!(
359    /// `PropertyBinaryEmojiPresentationV1`
360    PropertyBinaryEmojiPresentationV1,
361    PropertyCodePointSet<'static>,
362    is_singleton = true
363);
364icu_provider::data_marker!(
365    /// `PropertyBinaryEmojiV1`
366    PropertyBinaryEmojiV1,
367    PropertyCodePointSet<'static>,
368    is_singleton = true
369);
370icu_provider::data_marker!(
371    /// `PropertyBinaryExtendedPictographicV1`
372    PropertyBinaryExtendedPictographicV1,
373    PropertyCodePointSet<'static>,
374    is_singleton = true
375);
376icu_provider::data_marker!(
377    /// `PropertyBinaryExtenderV1`
378    PropertyBinaryExtenderV1,
379    PropertyCodePointSet<'static>,
380    is_singleton = true
381);
382icu_provider::data_marker!(
383    /// `PropertyBinaryFullCompositionExclusionV1`
384    PropertyBinaryFullCompositionExclusionV1,
385    PropertyCodePointSet<'static>,
386    is_singleton = true
387);
388icu_provider::data_marker!(
389    /// `PropertyBinaryGraphemeBaseV1`
390    PropertyBinaryGraphemeBaseV1,
391    PropertyCodePointSet<'static>,
392    is_singleton = true
393);
394icu_provider::data_marker!(
395    /// `PropertyBinaryGraphemeExtendV1`
396    PropertyBinaryGraphemeExtendV1,
397    PropertyCodePointSet<'static>,
398    is_singleton = true
399);
400icu_provider::data_marker!(
401    /// `PropertyBinaryGraphemeLinkV1`
402    PropertyBinaryGraphemeLinkV1,
403    PropertyCodePointSet<'static>,
404    is_singleton = true
405);
406icu_provider::data_marker!(
407    /// `PropertyBinaryGraphV1`
408    PropertyBinaryGraphV1,
409    PropertyCodePointSet<'static>,
410    is_singleton = true
411);
412icu_provider::data_marker!(
413    /// `PropertyBinaryHexDigitV1`
414    PropertyBinaryHexDigitV1,
415    PropertyCodePointSet<'static>,
416    is_singleton = true
417);
418icu_provider::data_marker!(
419    /// `PropertyBinaryHyphenV1`
420    PropertyBinaryHyphenV1,
421    PropertyCodePointSet<'static>,
422    is_singleton = true
423);
424icu_provider::data_marker!(
425    /// `PropertyBinaryIdCompatMathContinueV1`
426    PropertyBinaryIdCompatMathContinueV1,
427    PropertyCodePointSet<'static>,
428    is_singleton = true
429);
430icu_provider::data_marker!(
431    /// `PropertyBinaryIdCompatMathStartV1`
432    PropertyBinaryIdCompatMathStartV1,
433    PropertyCodePointSet<'static>,
434    is_singleton = true
435);
436icu_provider::data_marker!(
437    /// `PropertyBinaryIdContinueV1`
438    PropertyBinaryIdContinueV1,
439    PropertyCodePointSet<'static>,
440    is_singleton = true
441);
442icu_provider::data_marker!(
443    /// `PropertyBinaryIdeographicV1`
444    PropertyBinaryIdeographicV1,
445    PropertyCodePointSet<'static>,
446    is_singleton = true
447);
448icu_provider::data_marker!(
449    /// `PropertyBinaryIdsBinaryOperatorV1`
450    PropertyBinaryIdsBinaryOperatorV1,
451    PropertyCodePointSet<'static>,
452    is_singleton = true
453);
454icu_provider::data_marker!(
455    /// `PropertyBinaryIdStartV1`
456    PropertyBinaryIdStartV1,
457    PropertyCodePointSet<'static>,
458    is_singleton = true
459);
460icu_provider::data_marker!(
461    /// `PropertyBinaryIdsTrinaryOperatorV1`
462    PropertyBinaryIdsTrinaryOperatorV1,
463    PropertyCodePointSet<'static>,
464    is_singleton = true
465);
466icu_provider::data_marker!(
467    /// `PropertyBinaryIdsUnaryOperatorV1`
468    PropertyBinaryIdsUnaryOperatorV1,
469    PropertyCodePointSet<'static>,
470    is_singleton = true
471);
472icu_provider::data_marker!(
473    /// `PropertyBinaryJoinControlV1`
474    PropertyBinaryJoinControlV1,
475    PropertyCodePointSet<'static>,
476    is_singleton = true
477);
478icu_provider::data_marker!(
479    /// `PropertyBinaryLogicalOrderExceptionV1`
480    PropertyBinaryLogicalOrderExceptionV1,
481    PropertyCodePointSet<'static>,
482    is_singleton = true
483);
484icu_provider::data_marker!(
485    /// `PropertyBinaryLowercaseV1`
486    PropertyBinaryLowercaseV1,
487    PropertyCodePointSet<'static>,
488    is_singleton = true
489);
490icu_provider::data_marker!(
491    /// `PropertyBinaryMathV1`
492    PropertyBinaryMathV1,
493    PropertyCodePointSet<'static>,
494    is_singleton = true
495);
496icu_provider::data_marker!(
497    /// `PropertyBinaryModifierCombiningMarkV1`
498    PropertyBinaryModifierCombiningMarkV1,
499    PropertyCodePointSet<'static>,
500    is_singleton = true
501);
502icu_provider::data_marker!(
503    /// `PropertyBinaryNfcInertV1`
504    PropertyBinaryNfcInertV1,
505    PropertyCodePointSet<'static>,
506    is_singleton = true
507);
508icu_provider::data_marker!(
509    /// `PropertyBinaryNfdInertV1`
510    PropertyBinaryNfdInertV1,
511    PropertyCodePointSet<'static>,
512    is_singleton = true
513);
514icu_provider::data_marker!(
515    /// `PropertyBinaryNfkcInertV1`
516    PropertyBinaryNfkcInertV1,
517    PropertyCodePointSet<'static>,
518    is_singleton = true
519);
520icu_provider::data_marker!(
521    /// `PropertyBinaryNfkdInertV1`
522    PropertyBinaryNfkdInertV1,
523    PropertyCodePointSet<'static>,
524    is_singleton = true
525);
526icu_provider::data_marker!(
527    /// `PropertyBinaryNoncharacterCodePointV1`
528    PropertyBinaryNoncharacterCodePointV1,
529    PropertyCodePointSet<'static>,
530    is_singleton = true
531);
532icu_provider::data_marker!(
533    /// `PropertyBinaryPatternSyntaxV1`
534    PropertyBinaryPatternSyntaxV1,
535    PropertyCodePointSet<'static>,
536    is_singleton = true
537);
538icu_provider::data_marker!(
539    /// `PropertyBinaryPatternWhiteSpaceV1`
540    PropertyBinaryPatternWhiteSpaceV1,
541    PropertyCodePointSet<'static>,
542    is_singleton = true
543);
544icu_provider::data_marker!(
545    /// `PropertyBinaryPrependedConcatenationMarkV1`
546    PropertyBinaryPrependedConcatenationMarkV1,
547    PropertyCodePointSet<'static>,
548    is_singleton = true
549);
550icu_provider::data_marker!(
551    /// `PropertyBinaryPrintV1`
552    PropertyBinaryPrintV1,
553    PropertyCodePointSet<'static>,
554    is_singleton = true
555);
556icu_provider::data_marker!(
557    /// `PropertyBinaryQuotationMarkV1`
558    PropertyBinaryQuotationMarkV1,
559    PropertyCodePointSet<'static>,
560    is_singleton = true
561);
562icu_provider::data_marker!(
563    /// `PropertyBinaryRadicalV1`
564    PropertyBinaryRadicalV1,
565    PropertyCodePointSet<'static>,
566    is_singleton = true
567);
568icu_provider::data_marker!(
569    /// `PropertyBinaryRegionalIndicatorV1`
570    PropertyBinaryRegionalIndicatorV1,
571    PropertyCodePointSet<'static>,
572    is_singleton = true
573);
574icu_provider::data_marker!(
575    /// `PropertyBinarySegmentStarterV1`
576    PropertyBinarySegmentStarterV1,
577    PropertyCodePointSet<'static>,
578    is_singleton = true
579);
580icu_provider::data_marker!(
581    /// `PropertyBinarySentenceTerminalV1`
582    PropertyBinarySentenceTerminalV1,
583    PropertyCodePointSet<'static>,
584    is_singleton = true
585);
586icu_provider::data_marker!(
587    /// `PropertyBinarySoftDottedV1`
588    PropertyBinarySoftDottedV1,
589    PropertyCodePointSet<'static>,
590    is_singleton = true
591);
592icu_provider::data_marker!(
593    /// `PropertyBinaryTerminalPunctuationV1`
594    PropertyBinaryTerminalPunctuationV1,
595    PropertyCodePointSet<'static>,
596    is_singleton = true
597);
598icu_provider::data_marker!(
599    /// `PropertyBinaryUnifiedIdeographV1`
600    PropertyBinaryUnifiedIdeographV1,
601    PropertyCodePointSet<'static>,
602    is_singleton = true
603);
604icu_provider::data_marker!(
605    /// `PropertyBinaryUppercaseV1`
606    PropertyBinaryUppercaseV1,
607    PropertyCodePointSet<'static>,
608    is_singleton = true
609);
610icu_provider::data_marker!(
611    /// `PropertyBinaryVariationSelectorV1`
612    PropertyBinaryVariationSelectorV1,
613    PropertyCodePointSet<'static>,
614    is_singleton = true
615);
616icu_provider::data_marker!(
617    /// `PropertyBinaryWhiteSpaceV1`
618    PropertyBinaryWhiteSpaceV1,
619    PropertyCodePointSet<'static>,
620    is_singleton = true
621);
622icu_provider::data_marker!(
623    /// `PropertyBinaryXdigitV1`
624    PropertyBinaryXdigitV1,
625    PropertyCodePointSet<'static>,
626    is_singleton = true
627);
628icu_provider::data_marker!(
629    /// `PropertyBinaryXidContinueV1`
630    PropertyBinaryXidContinueV1,
631    PropertyCodePointSet<'static>,
632    is_singleton = true
633);
634icu_provider::data_marker!(
635    /// `PropertyBinaryXidStartV1`
636    PropertyBinaryXidStartV1,
637    PropertyCodePointSet<'static>,
638    is_singleton = true
639);
640icu_provider::data_marker!(
641    /// Data marker for the 'BidiClass' Unicode property
642    PropertyEnumBidiClassV1,
643    PropertyCodePointMap<'static, BidiClass>,
644    is_singleton = true,
645);
646icu_provider::data_marker!(
647    /// Data marker for the 'Block' Unicode property
648    PropertyEnumBlockV1,
649    PropertyCodePointMap<'static, Block>,
650    is_singleton = true,
651);
652icu_provider::data_marker!(
653    /// Data marker for the 'CanonicalCombiningClass' Unicode property
654    PropertyEnumCanonicalCombiningClassV1,
655    PropertyCodePointMap<'static, CanonicalCombiningClass>,
656    is_singleton = true,
657);
658icu_provider::data_marker!(
659    /// Data marker for the 'EastAsianWidth' Unicode property
660    PropertyEnumEastAsianWidthV1,
661    PropertyCodePointMap<'static, EastAsianWidth>,
662    is_singleton = true,
663);
664icu_provider::data_marker!(
665    /// Data marker for the 'GeneralCategory' Unicode property
666    PropertyEnumGeneralCategoryV1,
667    PropertyCodePointMap<'static, GeneralCategory>,
668    is_singleton = true,
669);
670icu_provider::data_marker!(
671    /// Data marker for the 'GraphemeClusterBreak' Unicode property
672    PropertyEnumGraphemeClusterBreakV1,
673    PropertyCodePointMap<'static, GraphemeClusterBreak>,
674    is_singleton = true,
675);
676icu_provider::data_marker!(
677    /// Data marker for the 'HangulSyllableType' Unicode property
678    PropertyEnumHangulSyllableTypeV1,
679    PropertyCodePointMap<'static, HangulSyllableType>,
680    is_singleton = true,
681);
682icu_provider::data_marker!(
683    /// Data marker for the 'IndicConjunctBreak' Unicode property
684    PropertyEnumIndicConjunctBreakV1,
685    PropertyCodePointMap<'static, IndicConjunctBreak>,
686    is_singleton = true,
687);
688icu_provider::data_marker!(
689    /// Data marker for the 'IndicSyllabicCategory' Unicode property
690    PropertyEnumIndicSyllabicCategoryV1,
691    PropertyCodePointMap<'static, IndicSyllabicCategory>,
692    is_singleton = true,
693);
694icu_provider::data_marker!(
695    /// Data marker for the 'JoiningGroup' Unicode property
696    PropertyEnumJoiningGroupV1,
697    PropertyCodePointMap<'static, JoiningGroup>,
698    is_singleton = true,
699);
700icu_provider::data_marker!(
701    /// Data marker for the 'JoiningType' Unicode property
702    PropertyEnumJoiningTypeV1,
703    PropertyCodePointMap<'static, JoiningType>,
704    is_singleton = true,
705);
706icu_provider::data_marker!(
707    /// Data marker for the 'LineBreak' Unicode property
708    PropertyEnumLineBreakV1,
709    PropertyCodePointMap<'static, LineBreak>,
710    is_singleton = true,
711);
712icu_provider::data_marker!(
713    /// Data marker for the 'NumericValue' Unicode property
714    PropertyEnumNumericTypeV1,
715    PropertyCodePointMap<'static, NumericType>,
716    is_singleton = true,
717);
718icu_provider::data_marker!(
719    /// Data marker for the 'Script' Unicode property
720    PropertyEnumScriptV1,
721    PropertyCodePointMap<'static, Script>,
722    is_singleton = true,
723);
724icu_provider::data_marker!(
725    /// Data marker for the 'SentenceBreak' Unicode property
726    PropertyEnumSentenceBreakV1,
727    PropertyCodePointMap<'static, SentenceBreak>,
728    is_singleton = true,
729);
730icu_provider::data_marker!(
731    /// Data marker for the 'Vertical_Orientation' Unicode property
732    PropertyEnumVerticalOrientationV1,
733    PropertyCodePointMap<'static, VerticalOrientation>,
734    is_singleton = true,
735);
736icu_provider::data_marker!(
737    /// Data marker for the 'WordBreak' Unicode property
738    PropertyEnumWordBreakV1,
739    PropertyCodePointMap<'static, WordBreak>,
740    is_singleton = true,
741);
742icu_provider::data_marker!(
743    /// Data marker for the 'BidiMirroringGlyph' Unicode property
744    PropertyEnumBidiMirroringGlyphV1,
745    PropertyCodePointMap<'static, BidiMirroringGlyph>,
746    is_singleton = true,
747);
748icu_provider::data_marker!(
749    /// `PropertyBinaryBasicEmojiV1`
750    PropertyBinaryBasicEmojiV1,
751    PropertyUnicodeSet<'static>,
752    is_singleton = true
753);
754icu_provider::data_marker!(
755    /// `PropertyScriptWithExtensionsV1`
756    PropertyScriptWithExtensionsV1,
757    ScriptWithExtensionsProperty<'static>,
758    is_singleton = true
759);
760
761/// All data keys in this module.
762pub const MARKERS: &[DataMarkerInfo] = &[
763    PropertyNameLongBidiClassV1::INFO,
764    PropertyNameLongBlockV1::INFO,
765    #[cfg(feature = "alloc")]
766    PropertyNameLongCanonicalCombiningClassV1::INFO,
767    PropertyNameLongEastAsianWidthV1::INFO,
768    PropertyNameLongGeneralCategoryV1::INFO,
769    PropertyNameLongGraphemeClusterBreakV1::INFO,
770    PropertyNameLongHangulSyllableTypeV1::INFO,
771    PropertyNameLongIndicSyllabicCategoryV1::INFO,
772    PropertyNameLongIndicConjunctBreakV1::INFO,
773    PropertyNameLongJoiningGroupV1::INFO,
774    PropertyNameLongJoiningTypeV1::INFO,
775    PropertyNameLongLineBreakV1::INFO,
776    PropertyNameLongNumericTypeV1::INFO,
777    PropertyNameLongScriptV1::INFO,
778    PropertyNameLongSentenceBreakV1::INFO,
779    PropertyNameLongVerticalOrientationV1::INFO,
780    PropertyNameLongWordBreakV1::INFO,
781    PropertyNameParseBidiClassV1::INFO,
782    PropertyNameParseBlockV1::INFO,
783    PropertyNameParseCanonicalCombiningClassV1::INFO,
784    PropertyNameParseEastAsianWidthV1::INFO,
785    PropertyNameParseGeneralCategoryMaskV1::INFO,
786    PropertyNameParseGeneralCategoryV1::INFO,
787    PropertyNameParseGraphemeClusterBreakV1::INFO,
788    PropertyNameParseHangulSyllableTypeV1::INFO,
789    PropertyNameParseIndicSyllabicCategoryV1::INFO,
790    PropertyNameParseIndicConjunctBreakV1::INFO,
791    PropertyNameParseJoiningGroupV1::INFO,
792    PropertyNameParseJoiningTypeV1::INFO,
793    PropertyNameParseLineBreakV1::INFO,
794    PropertyNameParseNumericTypeV1::INFO,
795    PropertyNameParseScriptV1::INFO,
796    PropertyNameParseSentenceBreakV1::INFO,
797    PropertyNameParseVerticalOrientationV1::INFO,
798    PropertyNameParseWordBreakV1::INFO,
799    PropertyNameShortBidiClassV1::INFO,
800    PropertyNameShortBlockV1::INFO,
801    #[cfg(feature = "alloc")]
802    PropertyNameShortCanonicalCombiningClassV1::INFO,
803    PropertyNameShortEastAsianWidthV1::INFO,
804    PropertyNameShortGeneralCategoryV1::INFO,
805    PropertyNameShortGraphemeClusterBreakV1::INFO,
806    PropertyNameShortHangulSyllableTypeV1::INFO,
807    PropertyNameShortIndicSyllabicCategoryV1::INFO,
808    PropertyNameShortIndicConjunctBreakV1::INFO,
809    PropertyNameShortJoiningGroupV1::INFO,
810    PropertyNameShortJoiningTypeV1::INFO,
811    PropertyNameShortLineBreakV1::INFO,
812    PropertyNameShortNumericTypeV1::INFO,
813    PropertyNameShortScriptV1::INFO,
814    PropertyNameShortSentenceBreakV1::INFO,
815    PropertyNameShortVerticalOrientationV1::INFO,
816    PropertyNameShortWordBreakV1::INFO,
817    PropertyBinaryAlnumV1::INFO,
818    PropertyBinaryAlphabeticV1::INFO,
819    PropertyBinaryAsciiHexDigitV1::INFO,
820    PropertyBinaryBidiControlV1::INFO,
821    PropertyBinaryBidiMirroredV1::INFO,
822    PropertyBinaryBlankV1::INFO,
823    PropertyBinaryCasedV1::INFO,
824    PropertyBinaryCaseIgnorableV1::INFO,
825    PropertyBinaryCaseSensitiveV1::INFO,
826    PropertyBinaryChangesWhenCasefoldedV1::INFO,
827    PropertyBinaryChangesWhenCasemappedV1::INFO,
828    PropertyBinaryChangesWhenLowercasedV1::INFO,
829    PropertyBinaryChangesWhenNfkcCasefoldedV1::INFO,
830    PropertyBinaryChangesWhenTitlecasedV1::INFO,
831    PropertyBinaryChangesWhenUppercasedV1::INFO,
832    PropertyBinaryDashV1::INFO,
833    PropertyBinaryDefaultIgnorableCodePointV1::INFO,
834    PropertyBinaryDeprecatedV1::INFO,
835    PropertyBinaryDiacriticV1::INFO,
836    PropertyBinaryEmojiComponentV1::INFO,
837    PropertyBinaryEmojiModifierBaseV1::INFO,
838    PropertyBinaryEmojiModifierV1::INFO,
839    PropertyBinaryEmojiPresentationV1::INFO,
840    PropertyBinaryEmojiV1::INFO,
841    PropertyBinaryExtendedPictographicV1::INFO,
842    PropertyBinaryExtenderV1::INFO,
843    PropertyBinaryFullCompositionExclusionV1::INFO,
844    PropertyBinaryGraphemeBaseV1::INFO,
845    PropertyBinaryGraphemeExtendV1::INFO,
846    PropertyBinaryGraphemeLinkV1::INFO,
847    PropertyBinaryGraphV1::INFO,
848    PropertyBinaryHexDigitV1::INFO,
849    PropertyBinaryHyphenV1::INFO,
850    PropertyBinaryIdCompatMathContinueV1::INFO,
851    PropertyBinaryIdCompatMathStartV1::INFO,
852    PropertyBinaryIdContinueV1::INFO,
853    PropertyBinaryIdeographicV1::INFO,
854    PropertyBinaryIdsBinaryOperatorV1::INFO,
855    PropertyBinaryIdStartV1::INFO,
856    PropertyBinaryIdsTrinaryOperatorV1::INFO,
857    PropertyBinaryIdsUnaryOperatorV1::INFO,
858    PropertyBinaryJoinControlV1::INFO,
859    PropertyBinaryLogicalOrderExceptionV1::INFO,
860    PropertyBinaryLowercaseV1::INFO,
861    PropertyBinaryMathV1::INFO,
862    PropertyBinaryModifierCombiningMarkV1::INFO,
863    PropertyBinaryNfcInertV1::INFO,
864    PropertyBinaryNfdInertV1::INFO,
865    PropertyBinaryNfkcInertV1::INFO,
866    PropertyBinaryNfkdInertV1::INFO,
867    PropertyBinaryNoncharacterCodePointV1::INFO,
868    PropertyBinaryPatternSyntaxV1::INFO,
869    PropertyBinaryPatternWhiteSpaceV1::INFO,
870    PropertyBinaryPrependedConcatenationMarkV1::INFO,
871    PropertyBinaryPrintV1::INFO,
872    PropertyBinaryQuotationMarkV1::INFO,
873    PropertyBinaryRadicalV1::INFO,
874    PropertyBinaryRegionalIndicatorV1::INFO,
875    PropertyBinarySegmentStarterV1::INFO,
876    PropertyBinarySentenceTerminalV1::INFO,
877    PropertyBinarySoftDottedV1::INFO,
878    PropertyBinaryTerminalPunctuationV1::INFO,
879    PropertyBinaryUnifiedIdeographV1::INFO,
880    PropertyBinaryUppercaseV1::INFO,
881    PropertyBinaryVariationSelectorV1::INFO,
882    PropertyBinaryWhiteSpaceV1::INFO,
883    PropertyBinaryXdigitV1::INFO,
884    PropertyBinaryXidContinueV1::INFO,
885    PropertyBinaryXidStartV1::INFO,
886    PropertyEnumBidiClassV1::INFO,
887    PropertyEnumBlockV1::INFO,
888    PropertyEnumCanonicalCombiningClassV1::INFO,
889    PropertyEnumEastAsianWidthV1::INFO,
890    PropertyEnumGeneralCategoryV1::INFO,
891    PropertyEnumGraphemeClusterBreakV1::INFO,
892    PropertyEnumHangulSyllableTypeV1::INFO,
893    PropertyEnumIndicConjunctBreakV1::INFO,
894    PropertyEnumIndicSyllabicCategoryV1::INFO,
895    PropertyEnumJoiningGroupV1::INFO,
896    PropertyEnumJoiningTypeV1::INFO,
897    PropertyEnumLineBreakV1::INFO,
898    PropertyEnumNumericTypeV1::INFO,
899    PropertyEnumScriptV1::INFO,
900    PropertyEnumSentenceBreakV1::INFO,
901    PropertyEnumVerticalOrientationV1::INFO,
902    PropertyEnumWordBreakV1::INFO,
903    PropertyEnumBidiMirroringGlyphV1::INFO,
904    PropertyBinaryBasicEmojiV1::INFO,
905    PropertyScriptWithExtensionsV1::INFO,
906];
907
908/// A set of characters which share a particular property value.
909///
910/// This data enum is extensible, more backends may be added in the future.
911/// Old data can be used with newer code but not vice versa.
912///
913/// <div class="stab unstable">
914/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
915/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
916/// to be stable, their Rust representation might not be. Use with caution.
917/// </div>
918#[derive(Debug, Eq, PartialEq, Clone, yoke::Yokeable, zerofrom::ZeroFrom)]
919#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
920#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider))]
921#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
922#[non_exhaustive]
923pub enum PropertyCodePointSet<'data> {
924    /// The set of characters, represented as an inversion list
925    InversionList(#[cfg_attr(feature = "serde", serde(borrow))] CodePointInversionList<'data>),
926    // new variants should go BELOW existing ones
927    // Serde serializes based on variant name and index in the enum
928    // https://docs.rs/serde/latest/serde/trait.Serializer.html#tymethod.serialize_unit_variant
929}
930
931icu_provider::data_struct!(
932    PropertyCodePointSet<'_>,
933    #[cfg(feature = "datagen")]
934);
935
936// See CodePointSetData for documentation of these functions
937impl<'data> PropertyCodePointSet<'data> {
938    #[inline]
939    pub(crate) fn contains(&self, ch: char) -> bool {
940        match *self {
941            Self::InversionList(ref l) => l.contains(ch),
942        }
943    }
944
945    #[inline]
946    pub(crate) fn contains32(&self, ch: u32) -> bool {
947        match *self {
948            Self::InversionList(ref l) => l.contains32(ch),
949        }
950    }
951
952    #[inline]
953    pub(crate) fn iter_ranges(&self) -> impl Iterator<Item = RangeInclusive<u32>> + '_ {
954        match *self {
955            Self::InversionList(ref l) => l.iter_ranges(),
956        }
957    }
958
959    #[inline]
960    pub(crate) fn iter_ranges_complemented(
961        &self,
962    ) -> impl Iterator<Item = RangeInclusive<u32>> + '_ {
963        match *self {
964            Self::InversionList(ref l) => l.iter_ranges_complemented(),
965        }
966    }
967
968    #[inline]
969    pub(crate) fn from_code_point_inversion_list(l: CodePointInversionList<'static>) -> Self {
970        Self::InversionList(l)
971    }
972
973    #[inline]
974    #[allow(clippy::unnecessary_wraps)] // extensibly designed
975    pub(crate) fn as_code_point_inversion_list(
976        &'_ self,
977    ) -> Option<&'_ CodePointInversionList<'data>> {
978        match *self {
979            Self::InversionList(ref l) => Some(l),
980            // any other backing data structure that cannot return a CPInvList in O(1) time should return None
981        }
982    }
983
984    #[inline]
985    pub(crate) fn to_code_point_inversion_list(&self) -> CodePointInversionList<'_> {
986        match *self {
987            Self::InversionList(ref t) => ZeroFrom::zero_from(t),
988        }
989    }
990}
991
992/// A map efficiently storing data about individual characters.
993///
994/// This data enum is extensible, more backends may be added in the future.
995/// Old data can be used with newer code but not vice versa.
996///
997/// <div class="stab unstable">
998/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
999/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
1000/// to be stable, their Rust representation might not be. Use with caution.
1001/// </div>
1002#[derive(Clone, Debug, Eq, PartialEq, yoke::Yokeable, zerofrom::ZeroFrom)]
1003#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
1004#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider))]
1005#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
1006#[non_exhaustive]
1007pub enum PropertyCodePointMap<'data, T: TrieValue> {
1008    /// A codepoint trie storing the data
1009    CodePointTrie(#[cfg_attr(feature = "serde", serde(borrow))] CodePointTrie<'data, T>),
1010    // new variants should go BELOW existing ones
1011    // Serde serializes based on variant name and index in the enum
1012    // https://docs.rs/serde/latest/serde/trait.Serializer.html#tymethod.serialize_unit_variant
1013}
1014
1015icu_provider::data_struct!(
1016    <T: TrieValue> PropertyCodePointMap<'_, T>,
1017    #[cfg(feature = "datagen")]
1018);
1019
1020// See CodePointMapData for documentation of these functions
1021impl<'data, T: TrieValue> PropertyCodePointMap<'data, T> {
1022    #[inline]
1023    pub(crate) fn get32(&self, ch: u32) -> T {
1024        match *self {
1025            Self::CodePointTrie(ref t) => t.get32(ch),
1026        }
1027    }
1028
1029    #[inline]
1030    pub(crate) fn get(&self, c: char) -> T {
1031        match *self {
1032            Self::CodePointTrie(ref t) => t.get(c),
1033        }
1034    }
1035
1036    #[inline]
1037    #[cfg(feature = "alloc")]
1038    pub(crate) fn try_into_converted<P>(
1039        self,
1040    ) -> Result<PropertyCodePointMap<'data, P>, zerovec::ule::UleError>
1041    where
1042        P: TrieValue,
1043    {
1044        match self {
1045            Self::CodePointTrie(t) => t
1046                .try_into_converted()
1047                .map(PropertyCodePointMap::CodePointTrie),
1048        }
1049    }
1050
1051    #[inline]
1052    #[cfg(feature = "alloc")]
1053    pub(crate) fn get_set_for_value(&self, value: T) -> CodePointInversionList<'static> {
1054        match *self {
1055            Self::CodePointTrie(ref t) => t.get_set_for_value(value),
1056        }
1057    }
1058
1059    #[inline]
1060    pub(crate) fn iter_ranges(&self) -> impl Iterator<Item = CodePointMapRange<T>> + '_ {
1061        match *self {
1062            Self::CodePointTrie(ref t) => t.iter_ranges(),
1063        }
1064    }
1065    #[inline]
1066    pub(crate) fn iter_ranges_mapped<'a, U: Eq + 'a>(
1067        &'a self,
1068        map: impl FnMut(T) -> U + Copy + 'a,
1069    ) -> impl Iterator<Item = CodePointMapRange<U>> + 'a {
1070        match *self {
1071            Self::CodePointTrie(ref t) => t.iter_ranges_mapped(map),
1072        }
1073    }
1074
1075    #[inline]
1076    pub(crate) fn from_code_point_trie(trie: CodePointTrie<'static, T>) -> Self {
1077        Self::CodePointTrie(trie)
1078    }
1079
1080    #[inline]
1081    #[allow(clippy::unnecessary_wraps)] // extensibly designed
1082    pub(crate) fn as_code_point_trie(&self) -> Option<&CodePointTrie<'data, T>> {
1083        match *self {
1084            Self::CodePointTrie(ref t) => Some(t),
1085            // any other backing data structure that cannot return a CPT in O(1) time should return None
1086        }
1087    }
1088
1089    #[inline]
1090    pub(crate) fn to_code_point_trie(&self) -> CodePointTrie<'_, T> {
1091        match *self {
1092            Self::CodePointTrie(ref t) => ZeroFrom::zero_from(t),
1093        }
1094    }
1095}
1096
1097/// A set of characters and strings which share a particular property value.
1098///
1099/// <div class="stab unstable">
1100/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
1101/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
1102/// to be stable, their Rust representation might not be. Use with caution.
1103/// </div>
1104#[derive(Debug, Eq, PartialEq, Clone, yoke::Yokeable, zerofrom::ZeroFrom)]
1105#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
1106#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider))]
1107#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
1108#[non_exhaustive]
1109pub enum PropertyUnicodeSet<'data> {
1110    /// A set representing characters in an inversion list, and the strings in a list.
1111    CPInversionListStrList(
1112        #[cfg_attr(feature = "serde", serde(borrow))] CodePointInversionListAndStringList<'data>,
1113    ),
1114    // new variants should go BELOW existing ones
1115    // Serde serializes based on variant name and index in the enum
1116    // https://docs.rs/serde/latest/serde/trait.Serializer.html#tymethod.serialize_unit_variant
1117}
1118
1119icu_provider::data_struct!(
1120    PropertyUnicodeSet<'_>,
1121    #[cfg(feature = "datagen")]
1122);
1123
1124impl<'data> PropertyUnicodeSet<'data> {
1125    #[inline]
1126    pub(crate) fn contains_str(&self, s: &str) -> bool {
1127        match *self {
1128            Self::CPInversionListStrList(ref l) => l.contains_str(s),
1129        }
1130    }
1131
1132    #[inline]
1133    pub(crate) fn contains_utf8(&self, s: &[u8]) -> bool {
1134        match *self {
1135            Self::CPInversionListStrList(ref l) => l.contains_utf8(s),
1136        }
1137    }
1138
1139    #[inline]
1140    pub(crate) fn contains32(&self, cp: u32) -> bool {
1141        match *self {
1142            Self::CPInversionListStrList(ref l) => l.contains32(cp),
1143        }
1144    }
1145
1146    #[inline]
1147    pub(crate) fn contains(&self, ch: char) -> bool {
1148        match *self {
1149            Self::CPInversionListStrList(ref l) => l.contains(ch),
1150        }
1151    }
1152
1153    #[inline]
1154    pub(crate) fn from_code_point_inversion_list_string_list(
1155        l: CodePointInversionListAndStringList<'static>,
1156    ) -> Self {
1157        Self::CPInversionListStrList(l)
1158    }
1159
1160    #[inline]
1161    #[allow(clippy::unnecessary_wraps)] // extensibly designed
1162    pub(crate) fn as_code_point_inversion_list_string_list(
1163        &'_ self,
1164    ) -> Option<&'_ CodePointInversionListAndStringList<'data>> {
1165        match *self {
1166            Self::CPInversionListStrList(ref l) => Some(l),
1167            // any other backing data structure that cannot return a CPInversionListStrList in O(1) time should return None
1168        }
1169    }
1170
1171    #[inline]
1172    pub(crate) fn to_code_point_inversion_list_string_list(
1173        &self,
1174    ) -> CodePointInversionListAndStringList<'_> {
1175        match *self {
1176            Self::CPInversionListStrList(ref t) => ZeroFrom::zero_from(t),
1177        }
1178    }
1179}
1180
1181/// A struct that efficiently stores `Script` and `Script_Extensions` property data.
1182///
1183/// <div class="stab unstable">
1184/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
1185/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
1186/// to be stable, their Rust representation might not be. Use with caution.
1187/// </div>
1188#[derive(Debug, Eq, PartialEq, Clone, yoke::Yokeable, zerofrom::ZeroFrom)]
1189#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
1190#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider))]
1191#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
1192pub struct ScriptWithExtensionsProperty<'data> {
1193    /// Note: The `ScriptWithExt` values in this array will assume a 12-bit layout. The 2
1194    /// higher order bits 11..10 will indicate how to deduce the Script value and
1195    /// `Script_Extensions` value, nearly matching the representation
1196    /// [in ICU](https://github.com/unicode-org/icu/blob/main/icu4c/source/common/uprops.h):
1197    ///
1198    /// | High order 2 bits value | Script                                                 | `Script_Extensions`                                              |
1199    /// |-------------------------|--------------------------------------------------------|----------------------------------------------------------------|
1200    /// | 3                       | First value in sub-array, index given by lower 10 bits | Sub-array excluding first value, index given by lower 10 bits  |
1201    /// | 2                       | Script=Inherited                                       | Entire sub-array, index given by lower 10 bits                 |
1202    /// | 1                       | Script=Common                                          | Entire sub-array, index given by lower 10 bits                 |
1203    /// | 0                       | Value in lower 10 bits                                 | `[ Script value ]` single-element array                        |
1204    ///
1205    /// When the lower 10 bits of the value are used as an index, that index is
1206    /// used for the outer-level vector of the nested `extensions` structure.
1207    #[cfg_attr(feature = "serde", serde(borrow))]
1208    pub trie: CodePointTrie<'data, ScriptWithExt>,
1209
1210    /// This companion structure stores `Script_Extensions` values, which are
1211    /// themselves arrays / vectors. This structure only stores the values for
1212    /// cases in which `scx(cp) != [ sc(cp) ]`. Each sub-vector is distinct. The
1213    /// sub-vector represents the `Script_Extensions` array value for a code point,
1214    /// and may also indicate Script value, as described for the `trie` field.
1215    #[cfg_attr(feature = "serde", serde(borrow))]
1216    pub extensions: VarZeroVec<'data, ZeroSlice<Script>>,
1217}
1218
1219icu_provider::data_struct!(
1220    ScriptWithExtensionsProperty<'_>,
1221    #[cfg(feature = "datagen")]
1222);