Debian Codegraph @

debian/rust-vendor/icu_properties/src/provider.rs

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