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