Skip to main content

unicode_types/generated/
runic.rs

1
2/// An enum to represent all characters in the Runic block.
3#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
4pub enum Runic {
5    /// \u{16a0}: 'ᚠ'
6    LetterFehuFeohFeF,
7    /// \u{16a1}: 'ᚡ'
8    LetterV,
9    /// \u{16a2}: 'ᚢ'
10    LetterUruzUrU,
11    /// \u{16a3}: 'ᚣ'
12    LetterYr,
13    /// \u{16a4}: 'ᚤ'
14    LetterY,
15    /// \u{16a5}: 'ᚥ'
16    LetterW,
17    /// \u{16a6}: 'ᚦ'
18    LetterThurisazThursThorn,
19    /// \u{16a7}: 'ᚧ'
20    LetterEth,
21    /// \u{16a8}: 'ᚨ'
22    LetterAnsuzA,
23    /// \u{16a9}: 'ᚩ'
24    LetterOsO,
25    /// \u{16aa}: 'ᚪ'
26    LetterAcA,
27    /// \u{16ab}: 'ᚫ'
28    LetterAesc,
29    /// \u{16ac}: 'ᚬ'
30    LetterLongDashBranchDashOssO,
31    /// \u{16ad}: 'ᚭ'
32    LetterShortDashTwigDashOssO,
33    /// \u{16ae}: 'ᚮ'
34    LetterO,
35    /// \u{16af}: 'ᚯ'
36    LetterOe,
37    /// \u{16b0}: 'ᚰ'
38    LetterOn,
39    /// \u{16b1}: 'ᚱ'
40    LetterRaidoRadReidR,
41    /// \u{16b2}: 'ᚲ'
42    LetterKauna,
43    /// \u{16b3}: 'ᚳ'
44    LetterCen,
45    /// \u{16b4}: 'ᚴ'
46    LetterKaunK,
47    /// \u{16b5}: 'ᚵ'
48    LetterG,
49    /// \u{16b6}: 'ᚶ'
50    LetterEng,
51    /// \u{16b7}: 'ᚷ'
52    LetterGeboGyfuG,
53    /// \u{16b8}: 'ᚸ'
54    LetterGar,
55    /// \u{16b9}: 'ᚹ'
56    LetterWunjoWynnW,
57    /// \u{16ba}: 'ᚺ'
58    LetterHaglazH,
59    /// \u{16bb}: 'ᚻ'
60    LetterHaeglH,
61    /// \u{16bc}: 'ᚼ'
62    LetterLongDashBranchDashHagallH,
63    /// \u{16bd}: 'ᚽ'
64    LetterShortDashTwigDashHagallH,
65    /// \u{16be}: 'ᚾ'
66    LetterNaudizNydNaudN,
67    /// \u{16bf}: 'ᚿ'
68    LetterShortDashTwigDashNaudN,
69    /// \u{16c0}: 'ᛀ'
70    LetterDottedDashN,
71    /// \u{16c1}: 'ᛁ'
72    LetterIsazIsIssI,
73    /// \u{16c2}: 'ᛂ'
74    LetterE,
75    /// \u{16c3}: 'ᛃ'
76    LetterJeranJ,
77    /// \u{16c4}: 'ᛄ'
78    LetterGer,
79    /// \u{16c5}: 'ᛅ'
80    LetterLongDashBranchDashArAe,
81    /// \u{16c6}: 'ᛆ'
82    LetterShortDashTwigDashArA,
83    /// \u{16c7}: 'ᛇ'
84    LetterIwazEoh,
85    /// \u{16c8}: 'ᛈ'
86    LetterPerthoPeorthP,
87    /// \u{16c9}: 'ᛉ'
88    LetterAlgizEolhx,
89    /// \u{16ca}: 'ᛊ'
90    LetterSowiloS,
91    /// \u{16cb}: 'ᛋ'
92    LetterSigelLongDashBranchDashSolS,
93    /// \u{16cc}: 'ᛌ'
94    LetterShortDashTwigDashSolS,
95    /// \u{16cd}: 'ᛍ'
96    LetterC,
97    /// \u{16ce}: 'ᛎ'
98    LetterZ,
99    /// \u{16cf}: 'ᛏ'
100    LetterTiwazTirTyrT,
101    /// \u{16d0}: 'ᛐ'
102    LetterShortDashTwigDashTyrT,
103    /// \u{16d1}: 'ᛑ'
104    LetterD,
105    /// \u{16d2}: 'ᛒ'
106    LetterBerkananBeorcBjarkanB,
107    /// \u{16d3}: 'ᛓ'
108    LetterShortDashTwigDashBjarkanB,
109    /// \u{16d4}: 'ᛔ'
110    LetterDottedDashP,
111    /// \u{16d5}: 'ᛕ'
112    LetterOpenDashP,
113    /// \u{16d6}: 'ᛖ'
114    LetterEhwazEhE,
115    /// \u{16d7}: 'ᛗ'
116    LetterMannazManM,
117    /// \u{16d8}: 'ᛘ'
118    LetterLongDashBranchDashMadrM,
119    /// \u{16d9}: 'ᛙ'
120    LetterShortDashTwigDashMadrM,
121    /// \u{16da}: 'ᛚ'
122    LetterLaukazLaguLogrL,
123    /// \u{16db}: 'ᛛ'
124    LetterDottedDashL,
125    /// \u{16dc}: 'ᛜ'
126    LetterIngwaz,
127    /// \u{16dd}: 'ᛝ'
128    LetterIng,
129    /// \u{16de}: 'ᛞ'
130    LetterDagazDaegD,
131    /// \u{16df}: 'ᛟ'
132    LetterOthalanEthelO,
133    /// \u{16e0}: 'ᛠ'
134    LetterEar,
135    /// \u{16e1}: 'ᛡ'
136    LetterIor,
137    /// \u{16e2}: 'ᛢ'
138    LetterCweorth,
139    /// \u{16e3}: 'ᛣ'
140    LetterCalc,
141    /// \u{16e4}: 'ᛤ'
142    LetterCealc,
143    /// \u{16e5}: 'ᛥ'
144    LetterStan,
145    /// \u{16e6}: 'ᛦ'
146    LetterLongDashBranchDashYr,
147    /// \u{16e7}: 'ᛧ'
148    LetterShortDashTwigDashYr,
149    /// \u{16e8}: 'ᛨ'
150    LetterIcelandicDashYr,
151    /// \u{16e9}: 'ᛩ'
152    LetterQ,
153    /// \u{16ea}: 'ᛪ'
154    LetterX,
155    /// \u{16eb}: '᛫'
156    SinglePunctuation,
157    /// \u{16ec}: '᛬'
158    MultiplePunctuation,
159    /// \u{16ed}: '᛭'
160    CrossPunctuation,
161    /// \u{16ee}: 'ᛮ'
162    ArlaugSymbol,
163    /// \u{16ef}: 'ᛯ'
164    TvimadurSymbol,
165    /// \u{16f0}: 'ᛰ'
166    BelgthorSymbol,
167    /// \u{16f1}: 'ᛱ'
168    LetterK,
169    /// \u{16f2}: 'ᛲ'
170    LetterSh,
171    /// \u{16f3}: 'ᛳ'
172    LetterOo,
173    /// \u{16f4}: 'ᛴ'
174    LetterFranksCasketOs,
175    /// \u{16f5}: 'ᛵ'
176    LetterFranksCasketIs,
177    /// \u{16f6}: 'ᛶ'
178    LetterFranksCasketEh,
179    /// \u{16f7}: 'ᛷ'
180    LetterFranksCasketAc,
181    /// \u{16f8}: 'ᛸ'
182    LetterFranksCasketAesc,
183}
184
185impl Into<char> for Runic {
186    fn into(self) -> char {
187        match self {
188            Runic::LetterFehuFeohFeF => 'ᚠ',
189            Runic::LetterV => 'ᚡ',
190            Runic::LetterUruzUrU => 'ᚢ',
191            Runic::LetterYr => 'ᚣ',
192            Runic::LetterY => 'ᚤ',
193            Runic::LetterW => 'ᚥ',
194            Runic::LetterThurisazThursThorn => 'ᚦ',
195            Runic::LetterEth => 'ᚧ',
196            Runic::LetterAnsuzA => 'ᚨ',
197            Runic::LetterOsO => 'ᚩ',
198            Runic::LetterAcA => 'ᚪ',
199            Runic::LetterAesc => 'ᚫ',
200            Runic::LetterLongDashBranchDashOssO => 'ᚬ',
201            Runic::LetterShortDashTwigDashOssO => 'ᚭ',
202            Runic::LetterO => 'ᚮ',
203            Runic::LetterOe => 'ᚯ',
204            Runic::LetterOn => 'ᚰ',
205            Runic::LetterRaidoRadReidR => 'ᚱ',
206            Runic::LetterKauna => 'ᚲ',
207            Runic::LetterCen => 'ᚳ',
208            Runic::LetterKaunK => 'ᚴ',
209            Runic::LetterG => 'ᚵ',
210            Runic::LetterEng => 'ᚶ',
211            Runic::LetterGeboGyfuG => 'ᚷ',
212            Runic::LetterGar => 'ᚸ',
213            Runic::LetterWunjoWynnW => 'ᚹ',
214            Runic::LetterHaglazH => 'ᚺ',
215            Runic::LetterHaeglH => 'ᚻ',
216            Runic::LetterLongDashBranchDashHagallH => 'ᚼ',
217            Runic::LetterShortDashTwigDashHagallH => 'ᚽ',
218            Runic::LetterNaudizNydNaudN => 'ᚾ',
219            Runic::LetterShortDashTwigDashNaudN => 'ᚿ',
220            Runic::LetterDottedDashN => 'ᛀ',
221            Runic::LetterIsazIsIssI => 'ᛁ',
222            Runic::LetterE => 'ᛂ',
223            Runic::LetterJeranJ => 'ᛃ',
224            Runic::LetterGer => 'ᛄ',
225            Runic::LetterLongDashBranchDashArAe => 'ᛅ',
226            Runic::LetterShortDashTwigDashArA => 'ᛆ',
227            Runic::LetterIwazEoh => 'ᛇ',
228            Runic::LetterPerthoPeorthP => 'ᛈ',
229            Runic::LetterAlgizEolhx => 'ᛉ',
230            Runic::LetterSowiloS => 'ᛊ',
231            Runic::LetterSigelLongDashBranchDashSolS => 'ᛋ',
232            Runic::LetterShortDashTwigDashSolS => 'ᛌ',
233            Runic::LetterC => 'ᛍ',
234            Runic::LetterZ => 'ᛎ',
235            Runic::LetterTiwazTirTyrT => 'ᛏ',
236            Runic::LetterShortDashTwigDashTyrT => 'ᛐ',
237            Runic::LetterD => 'ᛑ',
238            Runic::LetterBerkananBeorcBjarkanB => 'ᛒ',
239            Runic::LetterShortDashTwigDashBjarkanB => 'ᛓ',
240            Runic::LetterDottedDashP => 'ᛔ',
241            Runic::LetterOpenDashP => 'ᛕ',
242            Runic::LetterEhwazEhE => 'ᛖ',
243            Runic::LetterMannazManM => 'ᛗ',
244            Runic::LetterLongDashBranchDashMadrM => 'ᛘ',
245            Runic::LetterShortDashTwigDashMadrM => 'ᛙ',
246            Runic::LetterLaukazLaguLogrL => 'ᛚ',
247            Runic::LetterDottedDashL => 'ᛛ',
248            Runic::LetterIngwaz => 'ᛜ',
249            Runic::LetterIng => 'ᛝ',
250            Runic::LetterDagazDaegD => 'ᛞ',
251            Runic::LetterOthalanEthelO => 'ᛟ',
252            Runic::LetterEar => 'ᛠ',
253            Runic::LetterIor => 'ᛡ',
254            Runic::LetterCweorth => 'ᛢ',
255            Runic::LetterCalc => 'ᛣ',
256            Runic::LetterCealc => 'ᛤ',
257            Runic::LetterStan => 'ᛥ',
258            Runic::LetterLongDashBranchDashYr => 'ᛦ',
259            Runic::LetterShortDashTwigDashYr => 'ᛧ',
260            Runic::LetterIcelandicDashYr => 'ᛨ',
261            Runic::LetterQ => 'ᛩ',
262            Runic::LetterX => 'ᛪ',
263            Runic::SinglePunctuation => '᛫',
264            Runic::MultiplePunctuation => '᛬',
265            Runic::CrossPunctuation => '᛭',
266            Runic::ArlaugSymbol => 'ᛮ',
267            Runic::TvimadurSymbol => 'ᛯ',
268            Runic::BelgthorSymbol => 'ᛰ',
269            Runic::LetterK => 'ᛱ',
270            Runic::LetterSh => 'ᛲ',
271            Runic::LetterOo => 'ᛳ',
272            Runic::LetterFranksCasketOs => 'ᛴ',
273            Runic::LetterFranksCasketIs => 'ᛵ',
274            Runic::LetterFranksCasketEh => 'ᛶ',
275            Runic::LetterFranksCasketAc => 'ᛷ',
276            Runic::LetterFranksCasketAesc => 'ᛸ',
277        }
278    }
279}
280
281impl std::convert::TryFrom<char> for Runic {
282    type Error = ();
283    fn try_from(c: char) -> Result<Self, Self::Error> {
284        match c {
285            'ᚠ' => Ok(Runic::LetterFehuFeohFeF),
286            'ᚡ' => Ok(Runic::LetterV),
287            'ᚢ' => Ok(Runic::LetterUruzUrU),
288            'ᚣ' => Ok(Runic::LetterYr),
289            'ᚤ' => Ok(Runic::LetterY),
290            'ᚥ' => Ok(Runic::LetterW),
291            'ᚦ' => Ok(Runic::LetterThurisazThursThorn),
292            'ᚧ' => Ok(Runic::LetterEth),
293            'ᚨ' => Ok(Runic::LetterAnsuzA),
294            'ᚩ' => Ok(Runic::LetterOsO),
295            'ᚪ' => Ok(Runic::LetterAcA),
296            'ᚫ' => Ok(Runic::LetterAesc),
297            'ᚬ' => Ok(Runic::LetterLongDashBranchDashOssO),
298            'ᚭ' => Ok(Runic::LetterShortDashTwigDashOssO),
299            'ᚮ' => Ok(Runic::LetterO),
300            'ᚯ' => Ok(Runic::LetterOe),
301            'ᚰ' => Ok(Runic::LetterOn),
302            'ᚱ' => Ok(Runic::LetterRaidoRadReidR),
303            'ᚲ' => Ok(Runic::LetterKauna),
304            'ᚳ' => Ok(Runic::LetterCen),
305            'ᚴ' => Ok(Runic::LetterKaunK),
306            'ᚵ' => Ok(Runic::LetterG),
307            'ᚶ' => Ok(Runic::LetterEng),
308            'ᚷ' => Ok(Runic::LetterGeboGyfuG),
309            'ᚸ' => Ok(Runic::LetterGar),
310            'ᚹ' => Ok(Runic::LetterWunjoWynnW),
311            'ᚺ' => Ok(Runic::LetterHaglazH),
312            'ᚻ' => Ok(Runic::LetterHaeglH),
313            'ᚼ' => Ok(Runic::LetterLongDashBranchDashHagallH),
314            'ᚽ' => Ok(Runic::LetterShortDashTwigDashHagallH),
315            'ᚾ' => Ok(Runic::LetterNaudizNydNaudN),
316            'ᚿ' => Ok(Runic::LetterShortDashTwigDashNaudN),
317            'ᛀ' => Ok(Runic::LetterDottedDashN),
318            'ᛁ' => Ok(Runic::LetterIsazIsIssI),
319            'ᛂ' => Ok(Runic::LetterE),
320            'ᛃ' => Ok(Runic::LetterJeranJ),
321            'ᛄ' => Ok(Runic::LetterGer),
322            'ᛅ' => Ok(Runic::LetterLongDashBranchDashArAe),
323            'ᛆ' => Ok(Runic::LetterShortDashTwigDashArA),
324            'ᛇ' => Ok(Runic::LetterIwazEoh),
325            'ᛈ' => Ok(Runic::LetterPerthoPeorthP),
326            'ᛉ' => Ok(Runic::LetterAlgizEolhx),
327            'ᛊ' => Ok(Runic::LetterSowiloS),
328            'ᛋ' => Ok(Runic::LetterSigelLongDashBranchDashSolS),
329            'ᛌ' => Ok(Runic::LetterShortDashTwigDashSolS),
330            'ᛍ' => Ok(Runic::LetterC),
331            'ᛎ' => Ok(Runic::LetterZ),
332            'ᛏ' => Ok(Runic::LetterTiwazTirTyrT),
333            'ᛐ' => Ok(Runic::LetterShortDashTwigDashTyrT),
334            'ᛑ' => Ok(Runic::LetterD),
335            'ᛒ' => Ok(Runic::LetterBerkananBeorcBjarkanB),
336            'ᛓ' => Ok(Runic::LetterShortDashTwigDashBjarkanB),
337            'ᛔ' => Ok(Runic::LetterDottedDashP),
338            'ᛕ' => Ok(Runic::LetterOpenDashP),
339            'ᛖ' => Ok(Runic::LetterEhwazEhE),
340            'ᛗ' => Ok(Runic::LetterMannazManM),
341            'ᛘ' => Ok(Runic::LetterLongDashBranchDashMadrM),
342            'ᛙ' => Ok(Runic::LetterShortDashTwigDashMadrM),
343            'ᛚ' => Ok(Runic::LetterLaukazLaguLogrL),
344            'ᛛ' => Ok(Runic::LetterDottedDashL),
345            'ᛜ' => Ok(Runic::LetterIngwaz),
346            'ᛝ' => Ok(Runic::LetterIng),
347            'ᛞ' => Ok(Runic::LetterDagazDaegD),
348            'ᛟ' => Ok(Runic::LetterOthalanEthelO),
349            'ᛠ' => Ok(Runic::LetterEar),
350            'ᛡ' => Ok(Runic::LetterIor),
351            'ᛢ' => Ok(Runic::LetterCweorth),
352            'ᛣ' => Ok(Runic::LetterCalc),
353            'ᛤ' => Ok(Runic::LetterCealc),
354            'ᛥ' => Ok(Runic::LetterStan),
355            'ᛦ' => Ok(Runic::LetterLongDashBranchDashYr),
356            'ᛧ' => Ok(Runic::LetterShortDashTwigDashYr),
357            'ᛨ' => Ok(Runic::LetterIcelandicDashYr),
358            'ᛩ' => Ok(Runic::LetterQ),
359            'ᛪ' => Ok(Runic::LetterX),
360            '᛫' => Ok(Runic::SinglePunctuation),
361            '᛬' => Ok(Runic::MultiplePunctuation),
362            '᛭' => Ok(Runic::CrossPunctuation),
363            'ᛮ' => Ok(Runic::ArlaugSymbol),
364            'ᛯ' => Ok(Runic::TvimadurSymbol),
365            'ᛰ' => Ok(Runic::BelgthorSymbol),
366            'ᛱ' => Ok(Runic::LetterK),
367            'ᛲ' => Ok(Runic::LetterSh),
368            'ᛳ' => Ok(Runic::LetterOo),
369            'ᛴ' => Ok(Runic::LetterFranksCasketOs),
370            'ᛵ' => Ok(Runic::LetterFranksCasketIs),
371            'ᛶ' => Ok(Runic::LetterFranksCasketEh),
372            'ᛷ' => Ok(Runic::LetterFranksCasketAc),
373            'ᛸ' => Ok(Runic::LetterFranksCasketAesc),
374            _ => Err(()),
375        }
376    }
377}
378
379impl Into<u32> for Runic {
380    fn into(self) -> u32 {
381        let c: char = self.into();
382        let hex = c
383            .escape_unicode()
384            .to_string()
385            .replace("\\u{", "")
386            .replace("}", "");
387        u32::from_str_radix(&hex, 16).unwrap()
388    }
389}
390
391impl std::convert::TryFrom<u32> for Runic {
392    type Error = ();
393    fn try_from(u: u32) -> Result<Self, Self::Error> {
394        if let Ok(c) = char::try_from(u) {
395            Self::try_from(c)
396        } else {
397            Err(())
398        }
399    }
400}
401
402impl Iterator for Runic {
403    type Item = Self;
404    fn next(&mut self) -> Option<Self> {
405        let index: u32 = (*self).into();
406        use std::convert::TryFrom;
407        Self::try_from(index + 1).ok()
408    }
409}
410
411impl Runic {
412    /// The character with the lowest index in this unicode block
413    pub fn new() -> Self {
414        Runic::LetterFehuFeohFeF
415    }
416
417    /// The character's name, in sentence case
418    pub fn name(&self) -> String {
419        let s = std::format!("Runic{:#?}", self);
420        string_morph::to_sentence_case(&s)
421    }
422}