Skip to main content

alphabet_detector/lang/
script.rs

1use super::UcdScript;
2use alphabet_detector_macros::Script;
3use strum_macros::{EnumCount as EnumCountDerive, EnumIter};
4
5// ISO 15924 code.
6/// Has aliases in comparison to [`UcdScript`](enum.UcdScript.html).
7/// Int representation is unstable and can be changed anytime.
8/// Code representation (const
9/// [`into_code`](enum.Script.html#method.into_code)/[`from_code`](enum.Script.html#method.from_code))
10/// or string representation (const
11/// [`into_str`](enum.Script.html#method.into_str)/[`from_str`](enum.Script.html#method.from_str))
12/// are more stable.
13#[derive(
14    Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, EnumCountDerive, EnumIter, Script,
15)]
16pub enum Script {
17    #[scr(short = "Adlm", code = 166)]
18    Adlam,
19    #[scr(short = "Ahom", code = 338)]
20    Ahom,
21    #[scr(short = "Hluw", code = 80)]
22    AnatolianHieroglyphs,
23    #[scr(short = "Arab", code = 160)]
24    Arabic,
25    #[scr(short = "Armn", code = 230)]
26    Armenian,
27    #[scr(short = "Avst", code = 134)]
28    Avestan,
29    #[scr(short = "Bali", code = 360)]
30    Balinese,
31    #[scr(short = "Bamu", code = 435)]
32    Bamum,
33    #[scr(short = "Bass", code = 259)]
34    BassaVah,
35    #[scr(short = "Batk", code = 365)]
36    Batak,
37    #[scr(short = "Beng", code = 325)]
38    Bengali,
39    #[scr(short = "Berf", code = 258)]
40    BeriaErfe,
41    #[scr(short = "Bhks", code = 334)]
42    Bhaiksuki,
43    #[scr(short = "Bopo", code = 285)]
44    Bopomofo,
45    #[scr(short = "Brah", code = 300)]
46    Brahmi,
47    #[scr(short = "Brai", code = 570)]
48    Braille,
49    #[scr(short = "Bugi", code = 367)]
50    Buginese,
51    #[scr(short = "Buhd", code = 372)]
52    Buhid,
53    #[scr(short = "Cans", code = 440)]
54    CanadianAboriginal,
55    #[scr(short = "Cari", code = 201)]
56    Carian,
57    #[scr(short = "Aghb", code = 239)]
58    CaucasianAlbanian,
59    #[scr(short = "Cakm", code = 349)]
60    Chakma,
61    #[scr(short = "Cham", code = 358)]
62    Cham,
63    #[scr(short = "Cher", code = 445)]
64    Cherokee,
65    #[scr(short = "Chrs", code = 109)]
66    Chorasmian,
67    #[scr(short = "Zyyy", code = 998)]
68    Common,
69    #[scr(short = "Copt", code = 204)]
70    Coptic,
71    #[scr(short = "Xsux", code = 20)]
72    Cuneiform,
73    #[scr(short = "Cprt", code = 403)]
74    Cypriot,
75    #[scr(short = "Cpmn", code = 402)]
76    CyproMinoan,
77    #[scr(short = "Cyrl", code = 220)]
78    Cyrillic,
79    #[scr(short = "Dsrt", code = 250)]
80    Deseret,
81    #[scr(short = "Deva", code = 315)]
82    Devanagari,
83    #[scr(short = "Diak", code = 342)]
84    DivesAkuru,
85    #[scr(short = "Dogr", code = 328)]
86    Dogra,
87    #[scr(short = "Dupl", code = 755)]
88    Duployan,
89    #[scr(short = "Egyp", code = 50)]
90    EgyptianHieroglyphs,
91    #[scr(short = "Elba", code = 226)]
92    Elbasan,
93    #[scr(short = "Elym", code = 128)]
94    Elymaic,
95    #[scr(short = "Ethi", code = 430)]
96    Ethiopic,
97    #[scr(short = "Gara", code = 164)]
98    Garay,
99    #[scr(short = "Geor", code = 240)]
100    Georgian,
101    #[scr(short = "Glag", code = 225)]
102    Glagolitic,
103    #[scr(short = "Goth", code = 206)]
104    Gothic,
105    #[scr(short = "Gran", code = 343)]
106    Grantha,
107    #[scr(short = "Grek", code = 200)]
108    Greek,
109    #[scr(short = "Gujr", code = 320)]
110    Gujarati,
111    #[scr(short = "Gong", code = 312)]
112    GunjalaGondi,
113    #[scr(short = "Guru", code = 310)]
114    Gurmukhi,
115    #[scr(short = "Gukh", code = 397)]
116    GurungKhema,
117    #[scr(short = "Hani", code = 500)]
118    Han,
119    #[scr(short = "Hang", code = 286)]
120    Hangul,
121    #[scr(short = "Rohg", code = 167)]
122    HanifiRohingya,
123    #[scr(short = "Hans", code = 501)]
124    HanSimplified,
125    #[scr(short = "Hant", code = 502)]
126    HanTraditional,
127    #[scr(short = "Hano", code = 371)]
128    Hanunoo,
129    #[scr(short = "Hatr", code = 127)]
130    Hatran,
131    #[scr(short = "Hebr", code = 125)]
132    Hebrew,
133    #[scr(short = "Hira", code = 410)]
134    Hiragana,
135    #[scr(short = "Armi", code = 124)]
136    ImperialAramaic,
137    #[scr(short = "Zinh", code = 994)]
138    Inherited,
139    #[scr(short = "Phli", code = 131)]
140    InscriptionalPahlavi,
141    #[scr(short = "Prti", code = 130)]
142    InscriptionalParthian,
143    #[scr(short = "Jpan", code = 413)]
144    Japanese,
145    #[scr(short = "Java", code = 361)]
146    Javanese,
147    #[scr(short = "Kthi", code = 317)]
148    Kaithi,
149    #[scr(short = "Knda", code = 345)]
150    Kannada,
151    #[scr(short = "Kana", code = 411)]
152    Katakana,
153    #[scr(short = "Kawi", code = 368)]
154    Kawi,
155    #[scr(short = "Kali", code = 357)]
156    KayahLi,
157    #[scr(short = "Khar", code = 305)]
158    Kharoshthi,
159    #[scr(short = "Kits", code = 288)]
160    KhitanSmallScript,
161    #[scr(short = "Khmr", code = 355)]
162    Khmer,
163    #[scr(short = "Khoj", code = 322)]
164    Khojki,
165    #[scr(short = "Sind", code = 318)]
166    Khudawadi,
167    #[scr(short = "Krai", code = 396)]
168    KiratRai,
169    #[scr(short = "Kore", code = 287)]
170    Korean,
171    #[scr(short = "Laoo", code = 356)]
172    Lao,
173    #[scr(short = "Latn", code = 215)]
174    Latin,
175    #[scr(short = "Lepc", code = 335)]
176    Lepcha,
177    #[scr(short = "Limb", code = 336)]
178    Limbu,
179    #[scr(short = "Lina", code = 400)]
180    LinearA,
181    #[scr(short = "Linb", code = 401)]
182    LinearB,
183    #[scr(short = "Lisu", code = 399)]
184    Lisu,
185    #[scr(short = "Lyci", code = 202)]
186    Lycian,
187    #[scr(short = "Lydi", code = 116)]
188    Lydian,
189    #[scr(short = "Mahj", code = 314)]
190    Mahajani,
191    #[scr(short = "Maka", code = 366)]
192    Makasar,
193    #[scr(short = "Mlym", code = 347)]
194    Malayalam,
195    #[scr(short = "Mand", code = 140)]
196    Mandaic,
197    #[scr(short = "Mani", code = 139)]
198    Manichaean,
199    #[scr(short = "Marc", code = 332)]
200    Marchen,
201    #[scr(short = "Gonm", code = 313)]
202    MasaramGondi,
203    #[scr(short = "Medf", code = 265)]
204    Medefaidrin,
205    #[scr(short = "Mtei", code = 337)]
206    MeeteiMayek,
207    #[scr(short = "Mend", code = 438)]
208    MendeKikakui,
209    #[scr(short = "Merc", code = 101)]
210    MeroiticCursive,
211    #[scr(short = "Mero", code = 100)]
212    MeroiticHieroglyphs,
213    #[scr(short = "Plrd", code = 282)]
214    Miao,
215    #[scr(short = "Modi", code = 324)]
216    Modi,
217    #[scr(short = "Mong", code = 145)]
218    Mongolian,
219    #[scr(short = "Mroo", code = 264)]
220    Mro,
221    #[scr(short = "Mult", code = 323)]
222    Multani,
223    #[scr(short = "Mymr", code = 350)]
224    Myanmar,
225    #[scr(short = "Nbat", code = 159)]
226    Nabataean,
227    #[scr(short = "Nagm", code = 295)]
228    NagMundari,
229    #[scr(short = "Nand", code = 311)]
230    Nandinagari,
231    #[scr(short = "Newa", code = 333)]
232    Newa,
233    #[scr(short = "Talu", code = 354)]
234    NewTaiLue,
235    #[scr(short = "Nkoo", code = 165)]
236    Nko,
237    #[scr(short = "Nshu", code = 499)]
238    Nushu,
239    #[scr(short = "Hmnp", code = 451)]
240    NyiakengPuachueHmong,
241    #[scr(short = "Ogam", code = 212)]
242    Ogham,
243    #[scr(short = "Olck", code = 261)]
244    OlChiki,
245    #[scr(short = "Hung", code = 176)]
246    OldHungarian,
247    #[scr(short = "Ital", code = 210)]
248    OldItalic,
249    #[scr(short = "Narb", code = 106)]
250    OldNorthArabian,
251    #[scr(short = "Perm", code = 227)]
252    OldPermic,
253    #[scr(short = "Xpeo", code = 30)]
254    OldPersian,
255    #[scr(short = "Sogo", code = 142)]
256    OldSogdian,
257    #[scr(short = "Sarb", code = 105)]
258    OldSouthArabian,
259    #[scr(short = "Orkh", code = 175)]
260    OldTurkic,
261    #[scr(short = "Ougr", code = 143)]
262    OldUyghur,
263    #[scr(short = "Onao", code = 296)]
264    OlOnal,
265    #[scr(short = "Orya", code = 327)]
266    Oriya,
267    #[scr(short = "Osge", code = 219)]
268    Osage,
269    #[scr(short = "Osma", code = 260)]
270    Osmanya,
271    #[scr(short = "Hmng", code = 450)]
272    PahawhHmong,
273    #[scr(short = "Palm", code = 126)]
274    Palmyrene,
275    #[scr(short = "Pauc", code = 263)]
276    PauCinHau,
277    #[scr(short = "Phag", code = 331)]
278    PhagsPa,
279    #[scr(short = "Phnx", code = 115)]
280    Phoenician,
281    #[scr(short = "Phlp", code = 132)]
282    PsalterPahlavi,
283    #[scr(short = "Rjng", code = 363)]
284    Rejang,
285    #[scr(short = "Runr", code = 211)]
286    Runic,
287    #[scr(short = "Samr", code = 123)]
288    Samaritan,
289    #[scr(short = "Saur", code = 344)]
290    Saurashtra,
291    #[scr(short = "Shrd", code = 319)]
292    Sharada,
293    #[scr(short = "Shaw", code = 281)]
294    Shavian,
295    #[scr(short = "Sidd", code = 302)]
296    Siddham,
297    #[scr(short = "Sidt", code = 180)]
298    Sidetic,
299    #[scr(short = "Sgnw", code = 95)]
300    SignWriting,
301    #[scr(short = "Sinh", code = 348)]
302    Sinhala,
303    #[scr(short = "Sogd", code = 141)]
304    Sogdian,
305    #[scr(short = "Sora", code = 398)]
306    SoraSompeng,
307    #[scr(short = "Soyo", code = 329)]
308    Soyombo,
309    #[scr(short = "Sund", code = 362)]
310    Sundanese,
311    #[scr(short = "Sunu", code = 274)]
312    Sunuwar,
313    #[scr(short = "Sylo", code = 316)]
314    SylotiNagri,
315    #[scr(short = "Syrc", code = 135)]
316    Syriac,
317    #[scr(short = "Tglg", code = 370)]
318    Tagalog,
319    #[scr(short = "Tagb", code = 373)]
320    Tagbanwa,
321    #[scr(short = "Tale", code = 353)]
322    TaiLe,
323    #[scr(short = "Lana", code = 351)]
324    TaiTham,
325    #[scr(short = "Tavt", code = 359)]
326    TaiViet,
327    #[scr(short = "Tayo", code = 380)]
328    TaiYo,
329    #[scr(short = "Takr", code = 321)]
330    Takri,
331    #[scr(short = "Taml", code = 346)]
332    Tamil,
333    #[scr(short = "Tnsa", code = 275)]
334    Tangsa,
335    #[scr(short = "Tang", code = 520)]
336    Tangut,
337    #[scr(short = "Telu", code = 340)]
338    Telugu,
339    #[scr(short = "Thaa", code = 170)]
340    Thaana,
341    #[scr(short = "Thai", code = 352)]
342    Thai,
343    #[scr(short = "Tibt", code = 330)]
344    Tibetan,
345    #[scr(short = "Tfng", code = 120)]
346    Tifinagh,
347    #[scr(short = "Tirh", code = 326)]
348    Tirhuta,
349    #[scr(short = "Todr", code = 229)]
350    Todhri,
351    #[scr(short = "Tols", code = 299)]
352    TolongSiki,
353    #[scr(short = "Toto", code = 294)]
354    Toto,
355    #[scr(short = "Tutg", code = 341)]
356    TuluTigalari,
357    #[scr(short = "Ugar", code = 40)]
358    Ugaritic,
359    #[scr(short = "Vaii", code = 470)]
360    Vai,
361    #[scr(short = "Vith", code = 228)]
362    Vithkuqi,
363    #[scr(short = "Wcho", code = 283)]
364    Wancho,
365    #[scr(short = "Wara", code = 262)]
366    WarangCiti,
367    #[scr(short = "Yezi", code = 192)]
368    Yezidi,
369    #[scr(short = "Yiii", code = 460)]
370    Yi,
371    #[scr(short = "Zanb", code = 339)]
372    ZanabazarSquare,
373}
374
375impl_try_from!(Script, u16, u16 i16 u32 i32 usize isize u64 i64 u128 i128);
376impl_serde!(Script, "Script");
377
378impl From<Script> for UcdScript {
379    #[inline]
380    fn from(s: Script) -> Self {
381        use Script::*;
382        match s {
383            Adlam => UcdScript::Adlam,
384            Ahom => UcdScript::Ahom,
385            AnatolianHieroglyphs => UcdScript::AnatolianHieroglyphs,
386            Arabic => UcdScript::Arabic,
387            Armenian => UcdScript::Armenian,
388            Avestan => UcdScript::Avestan,
389            Balinese => UcdScript::Balinese,
390            Bamum => UcdScript::Bamum,
391            BassaVah => UcdScript::BassaVah,
392            Batak => UcdScript::Batak,
393            Bengali => UcdScript::Bengali,
394            BeriaErfe => UcdScript::BeriaErfe,
395            Bhaiksuki => UcdScript::Bhaiksuki,
396            Bopomofo => UcdScript::Bopomofo,
397            Brahmi => UcdScript::Brahmi,
398            Braille => UcdScript::Braille,
399            Buginese => UcdScript::Buginese,
400            Buhid => UcdScript::Buhid,
401            CanadianAboriginal => UcdScript::CanadianAboriginal,
402            Carian => UcdScript::Carian,
403            CaucasianAlbanian => UcdScript::CaucasianAlbanian,
404            Chakma => UcdScript::Chakma,
405            Cham => UcdScript::Cham,
406            Cherokee => UcdScript::Cherokee,
407            Chorasmian => UcdScript::Chorasmian,
408            Common => UcdScript::Common,
409            Coptic => UcdScript::Coptic,
410            Cuneiform => UcdScript::Cuneiform,
411            Cypriot => UcdScript::Cypriot,
412            CyproMinoan => UcdScript::CyproMinoan,
413            Cyrillic => UcdScript::Cyrillic,
414            Deseret => UcdScript::Deseret,
415            Devanagari => UcdScript::Devanagari,
416            DivesAkuru => UcdScript::DivesAkuru,
417            Dogra => UcdScript::Dogra,
418            Duployan => UcdScript::Duployan,
419            EgyptianHieroglyphs => UcdScript::EgyptianHieroglyphs,
420            Elbasan => UcdScript::Elbasan,
421            Elymaic => UcdScript::Elymaic,
422            Ethiopic => UcdScript::Ethiopic,
423            Garay => UcdScript::Garay,
424            Georgian => UcdScript::Georgian,
425            Glagolitic => UcdScript::Glagolitic,
426            Gothic => UcdScript::Gothic,
427            Grantha => UcdScript::Grantha,
428            Greek => UcdScript::Greek,
429            Gujarati => UcdScript::Gujarati,
430            GunjalaGondi => UcdScript::GunjalaGondi,
431            Gurmukhi => UcdScript::Gurmukhi,
432            GurungKhema => UcdScript::GurungKhema,
433            Han => UcdScript::Han,
434            Hangul => UcdScript::Hangul,
435            HanifiRohingya => UcdScript::HanifiRohingya,
436            HanSimplified => UcdScript::Han,
437            HanTraditional => UcdScript::Han,
438            Hanunoo => UcdScript::Hanunoo,
439            Hatran => UcdScript::Hatran,
440            Hebrew => UcdScript::Hebrew,
441            Hiragana => UcdScript::Hiragana,
442            ImperialAramaic => UcdScript::ImperialAramaic,
443            Inherited => UcdScript::Inherited,
444            InscriptionalPahlavi => UcdScript::InscriptionalPahlavi,
445            InscriptionalParthian => UcdScript::InscriptionalParthian,
446            Japanese => UcdScript::Han,
447            Javanese => UcdScript::Javanese,
448            Kaithi => UcdScript::Kaithi,
449            Kannada => UcdScript::Kannada,
450            Katakana => UcdScript::Katakana,
451            Kawi => UcdScript::Kawi,
452            KayahLi => UcdScript::KayahLi,
453            Kharoshthi => UcdScript::Kharoshthi,
454            KhitanSmallScript => UcdScript::KhitanSmallScript,
455            Khmer => UcdScript::Khmer,
456            Khojki => UcdScript::Khojki,
457            Khudawadi => UcdScript::Khudawadi,
458            KiratRai => UcdScript::KiratRai,
459            Korean => UcdScript::Han,
460            Lao => UcdScript::Lao,
461            Latin => UcdScript::Latin,
462            Lepcha => UcdScript::Lepcha,
463            Limbu => UcdScript::Limbu,
464            LinearA => UcdScript::LinearA,
465            LinearB => UcdScript::LinearB,
466            Lisu => UcdScript::Lisu,
467            Lycian => UcdScript::Lycian,
468            Lydian => UcdScript::Lydian,
469            Mahajani => UcdScript::Mahajani,
470            Makasar => UcdScript::Makasar,
471            Malayalam => UcdScript::Malayalam,
472            Mandaic => UcdScript::Mandaic,
473            Manichaean => UcdScript::Manichaean,
474            Marchen => UcdScript::Marchen,
475            MasaramGondi => UcdScript::MasaramGondi,
476            Medefaidrin => UcdScript::Medefaidrin,
477            MeeteiMayek => UcdScript::MeeteiMayek,
478            MendeKikakui => UcdScript::MendeKikakui,
479            MeroiticCursive => UcdScript::MeroiticCursive,
480            MeroiticHieroglyphs => UcdScript::MeroiticHieroglyphs,
481            Miao => UcdScript::Miao,
482            Modi => UcdScript::Modi,
483            Mongolian => UcdScript::Mongolian,
484            Mro => UcdScript::Mro,
485            Multani => UcdScript::Multani,
486            Myanmar => UcdScript::Myanmar,
487            Nabataean => UcdScript::Nabataean,
488            NagMundari => UcdScript::NagMundari,
489            Nandinagari => UcdScript::Nandinagari,
490            Newa => UcdScript::Newa,
491            NewTaiLue => UcdScript::NewTaiLue,
492            Nko => UcdScript::Nko,
493            Nushu => UcdScript::Nushu,
494            NyiakengPuachueHmong => UcdScript::NyiakengPuachueHmong,
495            Ogham => UcdScript::Ogham,
496            OlChiki => UcdScript::OlChiki,
497            OldHungarian => UcdScript::OldHungarian,
498            OldItalic => UcdScript::OldItalic,
499            OldNorthArabian => UcdScript::OldNorthArabian,
500            OldPermic => UcdScript::OldPermic,
501            OldPersian => UcdScript::OldPersian,
502            OldSogdian => UcdScript::OldSogdian,
503            OldSouthArabian => UcdScript::OldSouthArabian,
504            OldTurkic => UcdScript::OldTurkic,
505            OldUyghur => UcdScript::OldUyghur,
506            OlOnal => UcdScript::OlOnal,
507            Oriya => UcdScript::Oriya,
508            Osage => UcdScript::Osage,
509            Osmanya => UcdScript::Osmanya,
510            PahawhHmong => UcdScript::PahawhHmong,
511            Palmyrene => UcdScript::Palmyrene,
512            PauCinHau => UcdScript::PauCinHau,
513            PhagsPa => UcdScript::PhagsPa,
514            Phoenician => UcdScript::Phoenician,
515            PsalterPahlavi => UcdScript::PsalterPahlavi,
516            Rejang => UcdScript::Rejang,
517            Runic => UcdScript::Runic,
518            Samaritan => UcdScript::Samaritan,
519            Saurashtra => UcdScript::Saurashtra,
520            Sharada => UcdScript::Sharada,
521            Shavian => UcdScript::Shavian,
522            Siddham => UcdScript::Siddham,
523            Sidetic => UcdScript::Sidetic,
524            SignWriting => UcdScript::SignWriting,
525            Sinhala => UcdScript::Sinhala,
526            Sogdian => UcdScript::Sogdian,
527            SoraSompeng => UcdScript::SoraSompeng,
528            Soyombo => UcdScript::Soyombo,
529            Sundanese => UcdScript::Sundanese,
530            Sunuwar => UcdScript::Sunuwar,
531            SylotiNagri => UcdScript::SylotiNagri,
532            Syriac => UcdScript::Syriac,
533            Tagalog => UcdScript::Tagalog,
534            Tagbanwa => UcdScript::Tagbanwa,
535            TaiLe => UcdScript::TaiLe,
536            TaiTham => UcdScript::TaiTham,
537            TaiViet => UcdScript::TaiViet,
538            TaiYo => UcdScript::TaiYo,
539            Takri => UcdScript::Takri,
540            Tamil => UcdScript::Tamil,
541            Tangsa => UcdScript::Tangsa,
542            Tangut => UcdScript::Tangut,
543            Telugu => UcdScript::Telugu,
544            Thaana => UcdScript::Thaana,
545            Thai => UcdScript::Thai,
546            Tibetan => UcdScript::Tibetan,
547            Tifinagh => UcdScript::Tifinagh,
548            Tirhuta => UcdScript::Tirhuta,
549            Todhri => UcdScript::Todhri,
550            TolongSiki => UcdScript::TolongSiki,
551            Toto => UcdScript::Toto,
552            TuluTigalari => UcdScript::TuluTigalari,
553            Ugaritic => UcdScript::Ugaritic,
554            Vai => UcdScript::Vai,
555            Vithkuqi => UcdScript::Vithkuqi,
556            Wancho => UcdScript::Wancho,
557            WarangCiti => UcdScript::WarangCiti,
558            Yezidi => UcdScript::Yezidi,
559            Yi => UcdScript::Yi,
560            ZanabazarSquare => UcdScript::ZanabazarSquare,
561        }
562    }
563}