1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

//! 🚧 \[Unstable\] Property names-related data for this component
//!
//! <div class="stab unstable">
//! 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
//! including in SemVer minor releases. While the serde representation of data structs is guaranteed
//! to be stable, their Rust representation might not be. Use with caution.
//! </div>
//!
//! Read more about data providers: [`icu_provider`]

use icu_locale_core::subtags::Script;
use icu_provider::prelude::*;

use zerotrie::ZeroTrieSimpleAscii;
use zerovec::ule::NichedOption;
use zerovec::{VarZeroVec, ZeroMap, ZeroVec};

/// A set of characters and strings which share a particular property value.
///
/// <div class="stab unstable">
/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
/// to be stable, their Rust representation might not be. Use with caution.
/// </div>
#[derive(Debug, Clone, PartialEq)]
#[icu_provider::data_struct(
    marker(BidiClassNameToValueV2Marker, "propnames/from/bc@2", singleton),
    marker(
        CanonicalCombiningClassNameToValueV2Marker,
        "propnames/from/ccc@2",
        singleton
    ),
    marker(EastAsianWidthNameToValueV2Marker, "propnames/from/ea@2", singleton),
    marker(
        GeneralCategoryMaskNameToValueV2Marker,
        "propnames/from/gcm@2",
        singleton
    ),
    marker(GeneralCategoryNameToValueV2Marker, "propnames/from/gc@2", singleton),
    marker(
        GraphemeClusterBreakNameToValueV2Marker,
        "propnames/from/GCB@2",
        singleton
    ),
    marker(
        HangulSyllableTypeNameToValueV2Marker,
        "propnames/from/hst@2",
        singleton
    ),
    marker(
        IndicSyllabicCategoryNameToValueV2Marker,
        "propnames/from/InSC@2",
        singleton
    ),
    marker(JoiningTypeNameToValueV2Marker, "propnames/from/jt@2", singleton),
    marker(LineBreakNameToValueV2Marker, "propnames/from/lb@2", singleton),
    marker(ScriptNameToValueV2Marker, "propnames/from/sc@2", singleton),
    marker(SentenceBreakNameToValueV2Marker, "propnames/from/SB@2", singleton),
    marker(WordBreakNameToValueV2Marker, "propnames/from/WB@2", singleton)
)]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider::names))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub struct PropertyValueNameToEnumMapV1<'data> {
    /// A map from names to their value discriminant
    #[cfg_attr(feature = "serde", serde(borrow))]
    pub map: ZeroTrieSimpleAscii<ZeroVec<'data, u8>>,
}

/// A mapping of property values to their names. A single instance of this map will only cover
/// either long or short names, determined whilst loading data.
///
/// <div class="stab unstable">
/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
/// to be stable, their Rust representation might not be. Use with caution.
/// </div>
#[derive(Debug, Clone, PartialEq)]
#[icu_provider::data_struct(
    marker(
        CanonicalCombiningClassValueToLongNameV1Marker,
        "propnames/to/long/sparse/ccc@1",
        singleton
    ),
    marker(
        CanonicalCombiningClassValueToShortNameV1Marker,
        "propnames/to/short/sparse/ccc@1",
        singleton
    )
)]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider::names))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[yoke(prove_covariance_manually)]
pub struct PropertyEnumToValueNameSparseMapV1<'data> {
    /// A map from the value discriminant to the names
    #[cfg_attr(feature = "serde", serde(borrow))]
    pub map: ZeroMap<'data, u16, str>,
}

/// A mapping of property values to their names. A single instance of this map will only cover
/// either long or short names, determined whilst loading data.
///
/// <div class="stab unstable">
/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
/// to be stable, their Rust representation might not be. Use with caution.
/// </div>
#[derive(Debug, Clone, PartialEq)]
#[icu_provider::data_struct(
    marker(
        BidiClassValueToLongNameV1Marker,
        "propnames/to/long/linear/bc@1",
        singleton
    ),
    marker(
        BidiClassValueToShortNameV1Marker,
        "propnames/to/short/linear/bc@1",
        singleton
    ),
    marker(
        EastAsianWidthValueToLongNameV1Marker,
        "propnames/to/long/linear/ea@1",
        singleton
    ),
    marker(
        EastAsianWidthValueToShortNameV1Marker,
        "propnames/to/short/linear/ea@1",
        singleton
    ),
    marker(
        GeneralCategoryValueToLongNameV1Marker,
        "propnames/to/long/linear/gc@1",
        singleton
    ),
    marker(
        GeneralCategoryValueToShortNameV1Marker,
        "propnames/to/short/linear/gc@1",
        singleton
    ),
    marker(
        GraphemeClusterBreakValueToLongNameV1Marker,
        "propnames/to/long/linear/GCB@1",
        singleton
    ),
    marker(
        GraphemeClusterBreakValueToShortNameV1Marker,
        "propnames/to/short/linear/GCB@1",
        singleton
    ),
    marker(
        HangulSyllableTypeValueToLongNameV1Marker,
        "propnames/to/long/linear/hst@1",
        singleton
    ),
    marker(
        HangulSyllableTypeValueToShortNameV1Marker,
        "propnames/to/short/linear/hst@1",
        singleton
    ),
    marker(
        IndicSyllabicCategoryValueToLongNameV1Marker,
        "propnames/to/long/linear/InSC@1",
        singleton
    ),
    marker(
        IndicSyllabicCategoryValueToShortNameV1Marker,
        "propnames/to/short/linear/InSC@1",
        singleton
    ),
    marker(
        JoiningTypeValueToLongNameV1Marker,
        "propnames/to/long/linear/jt@1",
        singleton
    ),
    marker(
        JoiningTypeValueToShortNameV1Marker,
        "propnames/to/short/linear/jt@1",
        singleton
    ),
    marker(
        LineBreakValueToLongNameV1Marker,
        "propnames/to/long/linear/lb@1",
        singleton
    ),
    marker(
        LineBreakValueToShortNameV1Marker,
        "propnames/to/short/linear/lb@1",
        singleton
    ),
    marker(
        ScriptValueToLongNameV1Marker,
        "propnames/to/long/linear/sc@1",
        singleton
    ),
    marker(
        SentenceBreakValueToLongNameV1Marker,
        "propnames/to/long/linear/SB@1",
        singleton
    ),
    marker(
        SentenceBreakValueToShortNameV1Marker,
        "propnames/to/short/linear/SB@1",
        singleton
    ),
    marker(
        WordBreakValueToLongNameV1Marker,
        "propnames/to/long/linear/WB@1",
        singleton
    ),
    marker(
        WordBreakValueToShortNameV1Marker,
        "propnames/to/short/linear/WB@1",
        singleton
    )
)]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider::names))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[yoke(prove_covariance_manually)]
pub struct PropertyEnumToValueNameLinearMapV1<'data> {
    /// A map from the value discriminant (the index) to the names, for mostly
    /// contiguous data. Empty strings count as missing.
    #[cfg_attr(feature = "serde", serde(borrow))]
    pub map: VarZeroVec<'data, str>,
}

/// A mapping of property values to their names. A single instance of this map will only cover
/// either long or short names, determined whilst loading data.
///
/// <div class="stab unstable">
/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
/// including in SemVer minor releases. While the serde representation of data structs is guaranteed
/// to be stable, their Rust representation might not be. Use with caution.
/// </div>
#[derive(Debug, Clone, PartialEq)]
#[icu_provider::data_struct(marker(
    ScriptValueToShortNameV1Marker,
    "propnames/to/short/linear4/sc@1",
    singleton
))]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_properties::provider::names))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[yoke(prove_covariance_manually)]
pub struct PropertyScriptToIcuScriptMapV1<'data> {
    /// A map from the value discriminant (the index) to the names, for mostly
    /// contiguous data. Empty strings count as missing.
    #[cfg_attr(feature = "serde", serde(borrow))]
    pub map: ZeroVec<'data, NichedOption<Script, 4>>,
}