unicode_types/generated/
ahom.rs

1
2/// An enum to represent all characters in the Ahom block.
3#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
4pub enum Ahom {
5    /// \u{11700}: '𑜀'
6    LetterKa,
7    /// \u{11701}: '𑜁'
8    LetterKha,
9    /// \u{11702}: '𑜂'
10    LetterNga,
11    /// \u{11703}: '𑜃'
12    LetterNa,
13    /// \u{11704}: '𑜄'
14    LetterTa,
15    /// \u{11705}: '𑜅'
16    LetterAlternateTa,
17    /// \u{11706}: '𑜆'
18    LetterPa,
19    /// \u{11707}: '𑜇'
20    LetterPha,
21    /// \u{11708}: '𑜈'
22    LetterBa,
23    /// \u{11709}: '𑜉'
24    LetterMa,
25    /// \u{1170a}: '𑜊'
26    LetterJa,
27    /// \u{1170b}: '𑜋'
28    LetterCha,
29    /// \u{1170c}: '𑜌'
30    LetterTha,
31    /// \u{1170d}: '𑜍'
32    LetterRa,
33    /// \u{1170e}: '𑜎'
34    LetterLa,
35    /// \u{1170f}: '𑜏'
36    LetterSa,
37    /// \u{11710}: '𑜐'
38    LetterNya,
39    /// \u{11711}: '𑜑'
40    LetterHa,
41    /// \u{11712}: '𑜒'
42    LetterA,
43    /// \u{11713}: '𑜓'
44    LetterDa,
45    /// \u{11714}: '𑜔'
46    LetterDha,
47    /// \u{11715}: '𑜕'
48    LetterGa,
49    /// \u{11716}: '𑜖'
50    LetterAlternateGa,
51    /// \u{11717}: '𑜗'
52    LetterGha,
53    /// \u{11718}: '𑜘'
54    LetterBha,
55    /// \u{11719}: '𑜙'
56    LetterJha,
57    /// \u{1171a}: '𑜚'
58    LetterAlternateBa,
59    /// \u{1171d}: '𑜝'
60    ConsonantSignMedialLa,
61    /// \u{1171e}: '𑜞'
62    ConsonantSignMedialRa,
63    /// \u{1171f}: '𑜟'
64    ConsonantSignMedialLigatingRa,
65    /// \u{11720}: '𑜠'
66    VowelSignA,
67    /// \u{11721}: '𑜡'
68    VowelSignAa,
69    /// \u{11722}: '𑜢'
70    VowelSignI,
71    /// \u{11723}: '𑜣'
72    VowelSignIi,
73    /// \u{11724}: '𑜤'
74    VowelSignU,
75    /// \u{11725}: '𑜥'
76    VowelSignUu,
77    /// \u{11726}: '𑜦'
78    VowelSignE,
79    /// \u{11727}: '𑜧'
80    VowelSignAw,
81    /// \u{11728}: '𑜨'
82    VowelSignO,
83    /// \u{11729}: '𑜩'
84    VowelSignAi,
85    /// \u{1172a}: '𑜪'
86    VowelSignAm,
87    /// \u{1172b}: '𑜫'
88    SignKiller,
89    /// \u{11730}: '𑜰'
90    DigitZero,
91    /// \u{11731}: '𑜱'
92    DigitOne,
93    /// \u{11732}: '𑜲'
94    DigitTwo,
95    /// \u{11733}: '𑜳'
96    DigitThree,
97    /// \u{11734}: '𑜴'
98    DigitFour,
99    /// \u{11735}: '𑜵'
100    DigitFive,
101    /// \u{11736}: '𑜶'
102    DigitSix,
103    /// \u{11737}: '𑜷'
104    DigitSeven,
105    /// \u{11738}: '𑜸'
106    DigitEight,
107    /// \u{11739}: '𑜹'
108    DigitNine,
109    /// \u{1173a}: '𑜺'
110    NumberTen,
111    /// \u{1173b}: '𑜻'
112    NumberTwenty,
113    /// \u{1173c}: '𑜼'
114    SignSmallSection,
115    /// \u{1173d}: '𑜽'
116    SignSection,
117    /// \u{1173e}: '𑜾'
118    SignRulai,
119}
120
121impl Into<char> for Ahom {
122    fn into(self) -> char {
123        match self {
124            Ahom::LetterKa => '𑜀',
125            Ahom::LetterKha => '𑜁',
126            Ahom::LetterNga => '𑜂',
127            Ahom::LetterNa => '𑜃',
128            Ahom::LetterTa => '𑜄',
129            Ahom::LetterAlternateTa => '𑜅',
130            Ahom::LetterPa => '𑜆',
131            Ahom::LetterPha => '𑜇',
132            Ahom::LetterBa => '𑜈',
133            Ahom::LetterMa => '𑜉',
134            Ahom::LetterJa => '𑜊',
135            Ahom::LetterCha => '𑜋',
136            Ahom::LetterTha => '𑜌',
137            Ahom::LetterRa => '𑜍',
138            Ahom::LetterLa => '𑜎',
139            Ahom::LetterSa => '𑜏',
140            Ahom::LetterNya => '𑜐',
141            Ahom::LetterHa => '𑜑',
142            Ahom::LetterA => '𑜒',
143            Ahom::LetterDa => '𑜓',
144            Ahom::LetterDha => '𑜔',
145            Ahom::LetterGa => '𑜕',
146            Ahom::LetterAlternateGa => '𑜖',
147            Ahom::LetterGha => '𑜗',
148            Ahom::LetterBha => '𑜘',
149            Ahom::LetterJha => '𑜙',
150            Ahom::LetterAlternateBa => '𑜚',
151            Ahom::ConsonantSignMedialLa => '𑜝',
152            Ahom::ConsonantSignMedialRa => '𑜞',
153            Ahom::ConsonantSignMedialLigatingRa => '𑜟',
154            Ahom::VowelSignA => '𑜠',
155            Ahom::VowelSignAa => '𑜡',
156            Ahom::VowelSignI => '𑜢',
157            Ahom::VowelSignIi => '𑜣',
158            Ahom::VowelSignU => '𑜤',
159            Ahom::VowelSignUu => '𑜥',
160            Ahom::VowelSignE => '𑜦',
161            Ahom::VowelSignAw => '𑜧',
162            Ahom::VowelSignO => '𑜨',
163            Ahom::VowelSignAi => '𑜩',
164            Ahom::VowelSignAm => '𑜪',
165            Ahom::SignKiller => '𑜫',
166            Ahom::DigitZero => '𑜰',
167            Ahom::DigitOne => '𑜱',
168            Ahom::DigitTwo => '𑜲',
169            Ahom::DigitThree => '𑜳',
170            Ahom::DigitFour => '𑜴',
171            Ahom::DigitFive => '𑜵',
172            Ahom::DigitSix => '𑜶',
173            Ahom::DigitSeven => '𑜷',
174            Ahom::DigitEight => '𑜸',
175            Ahom::DigitNine => '𑜹',
176            Ahom::NumberTen => '𑜺',
177            Ahom::NumberTwenty => '𑜻',
178            Ahom::SignSmallSection => '𑜼',
179            Ahom::SignSection => '𑜽',
180            Ahom::SignRulai => '𑜾',
181        }
182    }
183}
184
185impl std::convert::TryFrom<char> for Ahom {
186    type Error = ();
187    fn try_from(c: char) -> Result<Self, Self::Error> {
188        match c {
189            '𑜀' => Ok(Ahom::LetterKa),
190            '𑜁' => Ok(Ahom::LetterKha),
191            '𑜂' => Ok(Ahom::LetterNga),
192            '𑜃' => Ok(Ahom::LetterNa),
193            '𑜄' => Ok(Ahom::LetterTa),
194            '𑜅' => Ok(Ahom::LetterAlternateTa),
195            '𑜆' => Ok(Ahom::LetterPa),
196            '𑜇' => Ok(Ahom::LetterPha),
197            '𑜈' => Ok(Ahom::LetterBa),
198            '𑜉' => Ok(Ahom::LetterMa),
199            '𑜊' => Ok(Ahom::LetterJa),
200            '𑜋' => Ok(Ahom::LetterCha),
201            '𑜌' => Ok(Ahom::LetterTha),
202            '𑜍' => Ok(Ahom::LetterRa),
203            '𑜎' => Ok(Ahom::LetterLa),
204            '𑜏' => Ok(Ahom::LetterSa),
205            '𑜐' => Ok(Ahom::LetterNya),
206            '𑜑' => Ok(Ahom::LetterHa),
207            '𑜒' => Ok(Ahom::LetterA),
208            '𑜓' => Ok(Ahom::LetterDa),
209            '𑜔' => Ok(Ahom::LetterDha),
210            '𑜕' => Ok(Ahom::LetterGa),
211            '𑜖' => Ok(Ahom::LetterAlternateGa),
212            '𑜗' => Ok(Ahom::LetterGha),
213            '𑜘' => Ok(Ahom::LetterBha),
214            '𑜙' => Ok(Ahom::LetterJha),
215            '𑜚' => Ok(Ahom::LetterAlternateBa),
216            '𑜝' => Ok(Ahom::ConsonantSignMedialLa),
217            '𑜞' => Ok(Ahom::ConsonantSignMedialRa),
218            '𑜟' => Ok(Ahom::ConsonantSignMedialLigatingRa),
219            '𑜠' => Ok(Ahom::VowelSignA),
220            '𑜡' => Ok(Ahom::VowelSignAa),
221            '𑜢' => Ok(Ahom::VowelSignI),
222            '𑜣' => Ok(Ahom::VowelSignIi),
223            '𑜤' => Ok(Ahom::VowelSignU),
224            '𑜥' => Ok(Ahom::VowelSignUu),
225            '𑜦' => Ok(Ahom::VowelSignE),
226            '𑜧' => Ok(Ahom::VowelSignAw),
227            '𑜨' => Ok(Ahom::VowelSignO),
228            '𑜩' => Ok(Ahom::VowelSignAi),
229            '𑜪' => Ok(Ahom::VowelSignAm),
230            '𑜫' => Ok(Ahom::SignKiller),
231            '𑜰' => Ok(Ahom::DigitZero),
232            '𑜱' => Ok(Ahom::DigitOne),
233            '𑜲' => Ok(Ahom::DigitTwo),
234            '𑜳' => Ok(Ahom::DigitThree),
235            '𑜴' => Ok(Ahom::DigitFour),
236            '𑜵' => Ok(Ahom::DigitFive),
237            '𑜶' => Ok(Ahom::DigitSix),
238            '𑜷' => Ok(Ahom::DigitSeven),
239            '𑜸' => Ok(Ahom::DigitEight),
240            '𑜹' => Ok(Ahom::DigitNine),
241            '𑜺' => Ok(Ahom::NumberTen),
242            '𑜻' => Ok(Ahom::NumberTwenty),
243            '𑜼' => Ok(Ahom::SignSmallSection),
244            '𑜽' => Ok(Ahom::SignSection),
245            '𑜾' => Ok(Ahom::SignRulai),
246            _ => Err(()),
247        }
248    }
249}
250
251impl Into<u32> for Ahom {
252    fn into(self) -> u32 {
253        let c: char = self.into();
254        let hex = c
255            .escape_unicode()
256            .to_string()
257            .replace("\\u{", "")
258            .replace("}", "");
259        u32::from_str_radix(&hex, 16).unwrap()
260    }
261}
262
263impl std::convert::TryFrom<u32> for Ahom {
264    type Error = ();
265    fn try_from(u: u32) -> Result<Self, Self::Error> {
266        if let Ok(c) = char::try_from(u) {
267            Self::try_from(c)
268        } else {
269            Err(())
270        }
271    }
272}
273
274impl Iterator for Ahom {
275    type Item = Self;
276    fn next(&mut self) -> Option<Self> {
277        let index: u32 = (*self).into();
278        use std::convert::TryFrom;
279        Self::try_from(index + 1).ok()
280    }
281}
282
283impl Ahom {
284    /// The character with the lowest index in this unicode block
285    pub fn new() -> Self {
286        Ahom::LetterKa
287    }
288
289    /// The character's name, in sentence case
290    pub fn name(&self) -> String {
291        let s = std::format!("Ahom{:#?}", self);
292        string_morph::to_sentence_case(&s)
293    }
294}