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