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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
/// A number of constants to give a name to all characters in this block.
mod constants {
    /// \u{1c00}: 'ᰀ'
    pub const LETTER_KA: char = 'ᰀ';
    /// \u{1c01}: 'ᰁ'
    pub const LETTER_KLA: char = 'ᰁ';
    /// \u{1c02}: 'ᰂ'
    pub const LETTER_KHA: char = 'ᰂ';
    /// \u{1c03}: 'ᰃ'
    pub const LETTER_GA: char = 'ᰃ';
    /// \u{1c04}: 'ᰄ'
    pub const LETTER_GLA: char = 'ᰄ';
    /// \u{1c05}: 'ᰅ'
    pub const LETTER_NGA: char = 'ᰅ';
    /// \u{1c06}: 'ᰆ'
    pub const LETTER_CA: char = 'ᰆ';
    /// \u{1c07}: 'ᰇ'
    pub const LETTER_CHA: char = 'ᰇ';
    /// \u{1c08}: 'ᰈ'
    pub const LETTER_JA: char = 'ᰈ';
    /// \u{1c09}: 'ᰉ'
    pub const LETTER_NYA: char = 'ᰉ';
    /// \u{1c0a}: 'ᰊ'
    pub const LETTER_TA: char = 'ᰊ';
    /// \u{1c0b}: 'ᰋ'
    pub const LETTER_THA: char = 'ᰋ';
    /// \u{1c0c}: 'ᰌ'
    pub const LETTER_DA: char = 'ᰌ';
    /// \u{1c0d}: 'ᰍ'
    pub const LETTER_NA: char = 'ᰍ';
    /// \u{1c0e}: 'ᰎ'
    pub const LETTER_PA: char = 'ᰎ';
    /// \u{1c0f}: 'ᰏ'
    pub const LETTER_PLA: char = 'ᰏ';
    /// \u{1c10}: 'ᰐ'
    pub const LETTER_PHA: char = 'ᰐ';
    /// \u{1c11}: 'ᰑ'
    pub const LETTER_FA: char = 'ᰑ';
    /// \u{1c12}: 'ᰒ'
    pub const LETTER_FLA: char = 'ᰒ';
    /// \u{1c13}: 'ᰓ'
    pub const LETTER_BA: char = 'ᰓ';
    /// \u{1c14}: 'ᰔ'
    pub const LETTER_BLA: char = 'ᰔ';
    /// \u{1c15}: 'ᰕ'
    pub const LETTER_MA: char = 'ᰕ';
    /// \u{1c16}: 'ᰖ'
    pub const LETTER_MLA: char = 'ᰖ';
    /// \u{1c17}: 'ᰗ'
    pub const LETTER_TSA: char = 'ᰗ';
    /// \u{1c18}: 'ᰘ'
    pub const LETTER_TSHA: char = 'ᰘ';
    /// \u{1c19}: 'ᰙ'
    pub const LETTER_DZA: char = 'ᰙ';
    /// \u{1c1a}: 'ᰚ'
    pub const LETTER_YA: char = 'ᰚ';
    /// \u{1c1b}: 'ᰛ'
    pub const LETTER_RA: char = 'ᰛ';
    /// \u{1c1c}: 'ᰜ'
    pub const LETTER_LA: char = 'ᰜ';
    /// \u{1c1d}: 'ᰝ'
    pub const LETTER_HA: char = 'ᰝ';
    /// \u{1c1e}: 'ᰞ'
    pub const LETTER_HLA: char = 'ᰞ';
    /// \u{1c1f}: 'ᰟ'
    pub const LETTER_VA: char = 'ᰟ';
    /// \u{1c20}: 'ᰠ'
    pub const LETTER_SA: char = 'ᰠ';
    /// \u{1c21}: 'ᰡ'
    pub const LETTER_SHA: char = 'ᰡ';
    /// \u{1c22}: 'ᰢ'
    pub const LETTER_WA: char = 'ᰢ';
    /// \u{1c23}: 'ᰣ'
    pub const LETTER_A: char = 'ᰣ';
    /// \u{1c24}: 'ᰤ'
    pub const SUBJOINED_LETTER_YA: char = 'ᰤ';
    /// \u{1c25}: 'ᰥ'
    pub const SUBJOINED_LETTER_RA: char = 'ᰥ';
    /// \u{1c26}: 'ᰦ'
    pub const VOWEL_SIGN_AA: char = 'ᰦ';
    /// \u{1c27}: 'ᰧ'
    pub const VOWEL_SIGN_I: char = 'ᰧ';
    /// \u{1c28}: 'ᰨ'
    pub const VOWEL_SIGN_O: char = 'ᰨ';
    /// \u{1c29}: 'ᰩ'
    pub const VOWEL_SIGN_OO: char = 'ᰩ';
    /// \u{1c2a}: 'ᰪ'
    pub const VOWEL_SIGN_U: char = 'ᰪ';
    /// \u{1c2b}: 'ᰫ'
    pub const VOWEL_SIGN_UU: char = 'ᰫ';
    /// \u{1c2c}: 'ᰬ'
    pub const VOWEL_SIGN_E: char = 'ᰬ';
    /// \u{1c2d}: 'ᰭ'
    pub const CONSONANT_SIGN_K: char = 'ᰭ';
    /// \u{1c2e}: 'ᰮ'
    pub const CONSONANT_SIGN_M: char = 'ᰮ';
    /// \u{1c2f}: 'ᰯ'
    pub const CONSONANT_SIGN_L: char = 'ᰯ';
    /// \u{1c30}: 'ᰰ'
    pub const CONSONANT_SIGN_N: char = 'ᰰ';
    /// \u{1c31}: 'ᰱ'
    pub const CONSONANT_SIGN_P: char = 'ᰱ';
    /// \u{1c32}: 'ᰲ'
    pub const CONSONANT_SIGN_R: char = 'ᰲ';
    /// \u{1c33}: 'ᰳ'
    pub const CONSONANT_SIGN_T: char = 'ᰳ';
    /// \u{1c34}: 'ᰴ'
    pub const CONSONANT_SIGN_NYIN_DASH_DO: char = 'ᰴ';
    /// \u{1c35}: 'ᰵ'
    pub const CONSONANT_SIGN_KANG: char = 'ᰵ';
    /// \u{1c36}: 'ᰶ'
    pub const SIGN_RAN: char = 'ᰶ';
    /// \u{1c37}: '᰷'
    pub const SIGN_NUKTA: char = '᰷';
    /// \u{1c3b}: '᰻'
    pub const PUNCTUATION_TA_DASH_ROL: char = '᰻';
    /// \u{1c3c}: '᰼'
    pub const PUNCTUATION_NYET_THYOOM_TA_DASH_ROL: char = '᰼';
    /// \u{1c3d}: '᰽'
    pub const PUNCTUATION_CER_DASH_WA: char = '᰽';
    /// \u{1c3e}: '᰾'
    pub const PUNCTUATION_TSHOOK_CER_DASH_WA: char = '᰾';
    /// \u{1c3f}: '᰿'
    pub const PUNCTUATION_TSHOOK: char = '᰿';
    /// \u{1c40}: '᱀'
    pub const DIGIT_ZERO: char = '᱀';
    /// \u{1c41}: '᱁'
    pub const DIGIT_ONE: char = '᱁';
    /// \u{1c42}: '᱂'
    pub const DIGIT_TWO: char = '᱂';
    /// \u{1c43}: '᱃'
    pub const DIGIT_THREE: char = '᱃';
    /// \u{1c44}: '᱄'
    pub const DIGIT_FOUR: char = '᱄';
    /// \u{1c45}: '᱅'
    pub const DIGIT_FIVE: char = '᱅';
    /// \u{1c46}: '᱆'
    pub const DIGIT_SIX: char = '᱆';
    /// \u{1c47}: '᱇'
    pub const DIGIT_SEVEN: char = '᱇';
    /// \u{1c48}: '᱈'
    pub const DIGIT_EIGHT: char = '᱈';
    /// \u{1c49}: '᱉'
    pub const DIGIT_NINE: char = '᱉';
    /// \u{1c4d}: 'ᱍ'
    pub const LETTER_TTA: char = 'ᱍ';
    /// \u{1c4e}: 'ᱎ'
    pub const LETTER_TTHA: char = 'ᱎ';
}

/// An enum to represent all characters in the Lepcha block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum Lepcha {
    /// \u{1c00}: 'ᰀ'
    LetterKa,
    /// \u{1c01}: 'ᰁ'
    LetterKla,
    /// \u{1c02}: 'ᰂ'
    LetterKha,
    /// \u{1c03}: 'ᰃ'
    LetterGa,
    /// \u{1c04}: 'ᰄ'
    LetterGla,
    /// \u{1c05}: 'ᰅ'
    LetterNga,
    /// \u{1c06}: 'ᰆ'
    LetterCa,
    /// \u{1c07}: 'ᰇ'
    LetterCha,
    /// \u{1c08}: 'ᰈ'
    LetterJa,
    /// \u{1c09}: 'ᰉ'
    LetterNya,
    /// \u{1c0a}: 'ᰊ'
    LetterTa,
    /// \u{1c0b}: 'ᰋ'
    LetterTha,
    /// \u{1c0c}: 'ᰌ'
    LetterDa,
    /// \u{1c0d}: 'ᰍ'
    LetterNa,
    /// \u{1c0e}: 'ᰎ'
    LetterPa,
    /// \u{1c0f}: 'ᰏ'
    LetterPla,
    /// \u{1c10}: 'ᰐ'
    LetterPha,
    /// \u{1c11}: 'ᰑ'
    LetterFa,
    /// \u{1c12}: 'ᰒ'
    LetterFla,
    /// \u{1c13}: 'ᰓ'
    LetterBa,
    /// \u{1c14}: 'ᰔ'
    LetterBla,
    /// \u{1c15}: 'ᰕ'
    LetterMa,
    /// \u{1c16}: 'ᰖ'
    LetterMla,
    /// \u{1c17}: 'ᰗ'
    LetterTsa,
    /// \u{1c18}: 'ᰘ'
    LetterTsha,
    /// \u{1c19}: 'ᰙ'
    LetterDza,
    /// \u{1c1a}: 'ᰚ'
    LetterYa,
    /// \u{1c1b}: 'ᰛ'
    LetterRa,
    /// \u{1c1c}: 'ᰜ'
    LetterLa,
    /// \u{1c1d}: 'ᰝ'
    LetterHa,
    /// \u{1c1e}: 'ᰞ'
    LetterHla,
    /// \u{1c1f}: 'ᰟ'
    LetterVa,
    /// \u{1c20}: 'ᰠ'
    LetterSa,
    /// \u{1c21}: 'ᰡ'
    LetterSha,
    /// \u{1c22}: 'ᰢ'
    LetterWa,
    /// \u{1c23}: 'ᰣ'
    LetterA,
    /// \u{1c24}: 'ᰤ'
    SubjoinedLetterYa,
    /// \u{1c25}: 'ᰥ'
    SubjoinedLetterRa,
    /// \u{1c26}: 'ᰦ'
    VowelSignAa,
    /// \u{1c27}: 'ᰧ'
    VowelSignI,
    /// \u{1c28}: 'ᰨ'
    VowelSignO,
    /// \u{1c29}: 'ᰩ'
    VowelSignOo,
    /// \u{1c2a}: 'ᰪ'
    VowelSignU,
    /// \u{1c2b}: 'ᰫ'
    VowelSignUu,
    /// \u{1c2c}: 'ᰬ'
    VowelSignE,
    /// \u{1c2d}: 'ᰭ'
    ConsonantSignK,
    /// \u{1c2e}: 'ᰮ'
    ConsonantSignM,
    /// \u{1c2f}: 'ᰯ'
    ConsonantSignL,
    /// \u{1c30}: 'ᰰ'
    ConsonantSignN,
    /// \u{1c31}: 'ᰱ'
    ConsonantSignP,
    /// \u{1c32}: 'ᰲ'
    ConsonantSignR,
    /// \u{1c33}: 'ᰳ'
    ConsonantSignT,
    /// \u{1c34}: 'ᰴ'
    ConsonantSignNyinDashDo,
    /// \u{1c35}: 'ᰵ'
    ConsonantSignKang,
    /// \u{1c36}: 'ᰶ'
    SignRan,
    /// \u{1c37}: '᰷'
    SignNukta,
    /// \u{1c3b}: '᰻'
    PunctuationTaDashRol,
    /// \u{1c3c}: '᰼'
    PunctuationNyetThyoomTaDashRol,
    /// \u{1c3d}: '᰽'
    PunctuationCerDashWa,
    /// \u{1c3e}: '᰾'
    PunctuationTshookCerDashWa,
    /// \u{1c3f}: '᰿'
    PunctuationTshook,
    /// \u{1c40}: '᱀'
    DigitZero,
    /// \u{1c41}: '᱁'
    DigitOne,
    /// \u{1c42}: '᱂'
    DigitTwo,
    /// \u{1c43}: '᱃'
    DigitThree,
    /// \u{1c44}: '᱄'
    DigitFour,
    /// \u{1c45}: '᱅'
    DigitFive,
    /// \u{1c46}: '᱆'
    DigitSix,
    /// \u{1c47}: '᱇'
    DigitSeven,
    /// \u{1c48}: '᱈'
    DigitEight,
    /// \u{1c49}: '᱉'
    DigitNine,
    /// \u{1c4d}: 'ᱍ'
    LetterTta,
    /// \u{1c4e}: 'ᱎ'
    LetterTtha,
}

impl Into<char> for Lepcha {
    fn into(self) -> char {
        use constants::*;
        match self {
            Lepcha::LetterKa => LETTER_KA,
            Lepcha::LetterKla => LETTER_KLA,
            Lepcha::LetterKha => LETTER_KHA,
            Lepcha::LetterGa => LETTER_GA,
            Lepcha::LetterGla => LETTER_GLA,
            Lepcha::LetterNga => LETTER_NGA,
            Lepcha::LetterCa => LETTER_CA,
            Lepcha::LetterCha => LETTER_CHA,
            Lepcha::LetterJa => LETTER_JA,
            Lepcha::LetterNya => LETTER_NYA,
            Lepcha::LetterTa => LETTER_TA,
            Lepcha::LetterTha => LETTER_THA,
            Lepcha::LetterDa => LETTER_DA,
            Lepcha::LetterNa => LETTER_NA,
            Lepcha::LetterPa => LETTER_PA,
            Lepcha::LetterPla => LETTER_PLA,
            Lepcha::LetterPha => LETTER_PHA,
            Lepcha::LetterFa => LETTER_FA,
            Lepcha::LetterFla => LETTER_FLA,
            Lepcha::LetterBa => LETTER_BA,
            Lepcha::LetterBla => LETTER_BLA,
            Lepcha::LetterMa => LETTER_MA,
            Lepcha::LetterMla => LETTER_MLA,
            Lepcha::LetterTsa => LETTER_TSA,
            Lepcha::LetterTsha => LETTER_TSHA,
            Lepcha::LetterDza => LETTER_DZA,
            Lepcha::LetterYa => LETTER_YA,
            Lepcha::LetterRa => LETTER_RA,
            Lepcha::LetterLa => LETTER_LA,
            Lepcha::LetterHa => LETTER_HA,
            Lepcha::LetterHla => LETTER_HLA,
            Lepcha::LetterVa => LETTER_VA,
            Lepcha::LetterSa => LETTER_SA,
            Lepcha::LetterSha => LETTER_SHA,
            Lepcha::LetterWa => LETTER_WA,
            Lepcha::LetterA => LETTER_A,
            Lepcha::SubjoinedLetterYa => SUBJOINED_LETTER_YA,
            Lepcha::SubjoinedLetterRa => SUBJOINED_LETTER_RA,
            Lepcha::VowelSignAa => VOWEL_SIGN_AA,
            Lepcha::VowelSignI => VOWEL_SIGN_I,
            Lepcha::VowelSignO => VOWEL_SIGN_O,
            Lepcha::VowelSignOo => VOWEL_SIGN_OO,
            Lepcha::VowelSignU => VOWEL_SIGN_U,
            Lepcha::VowelSignUu => VOWEL_SIGN_UU,
            Lepcha::VowelSignE => VOWEL_SIGN_E,
            Lepcha::ConsonantSignK => CONSONANT_SIGN_K,
            Lepcha::ConsonantSignM => CONSONANT_SIGN_M,
            Lepcha::ConsonantSignL => CONSONANT_SIGN_L,
            Lepcha::ConsonantSignN => CONSONANT_SIGN_N,
            Lepcha::ConsonantSignP => CONSONANT_SIGN_P,
            Lepcha::ConsonantSignR => CONSONANT_SIGN_R,
            Lepcha::ConsonantSignT => CONSONANT_SIGN_T,
            Lepcha::ConsonantSignNyinDashDo => CONSONANT_SIGN_NYIN_DASH_DO,
            Lepcha::ConsonantSignKang => CONSONANT_SIGN_KANG,
            Lepcha::SignRan => SIGN_RAN,
            Lepcha::SignNukta => SIGN_NUKTA,
            Lepcha::PunctuationTaDashRol => PUNCTUATION_TA_DASH_ROL,
            Lepcha::PunctuationNyetThyoomTaDashRol => PUNCTUATION_NYET_THYOOM_TA_DASH_ROL,
            Lepcha::PunctuationCerDashWa => PUNCTUATION_CER_DASH_WA,
            Lepcha::PunctuationTshookCerDashWa => PUNCTUATION_TSHOOK_CER_DASH_WA,
            Lepcha::PunctuationTshook => PUNCTUATION_TSHOOK,
            Lepcha::DigitZero => DIGIT_ZERO,
            Lepcha::DigitOne => DIGIT_ONE,
            Lepcha::DigitTwo => DIGIT_TWO,
            Lepcha::DigitThree => DIGIT_THREE,
            Lepcha::DigitFour => DIGIT_FOUR,
            Lepcha::DigitFive => DIGIT_FIVE,
            Lepcha::DigitSix => DIGIT_SIX,
            Lepcha::DigitSeven => DIGIT_SEVEN,
            Lepcha::DigitEight => DIGIT_EIGHT,
            Lepcha::DigitNine => DIGIT_NINE,
            Lepcha::LetterTta => LETTER_TTA,
            Lepcha::LetterTtha => LETTER_TTHA,
        }
    }
}

impl std::convert::TryFrom<char> for Lepcha {
    type Error = ();
    fn try_from(c: char) -> Result<Self, Self::Error> {
        use constants::*;
        match c {
            LETTER_KA => Ok(Lepcha::LetterKa),
            LETTER_KLA => Ok(Lepcha::LetterKla),
            LETTER_KHA => Ok(Lepcha::LetterKha),
            LETTER_GA => Ok(Lepcha::LetterGa),
            LETTER_GLA => Ok(Lepcha::LetterGla),
            LETTER_NGA => Ok(Lepcha::LetterNga),
            LETTER_CA => Ok(Lepcha::LetterCa),
            LETTER_CHA => Ok(Lepcha::LetterCha),
            LETTER_JA => Ok(Lepcha::LetterJa),
            LETTER_NYA => Ok(Lepcha::LetterNya),
            LETTER_TA => Ok(Lepcha::LetterTa),
            LETTER_THA => Ok(Lepcha::LetterTha),
            LETTER_DA => Ok(Lepcha::LetterDa),
            LETTER_NA => Ok(Lepcha::LetterNa),
            LETTER_PA => Ok(Lepcha::LetterPa),
            LETTER_PLA => Ok(Lepcha::LetterPla),
            LETTER_PHA => Ok(Lepcha::LetterPha),
            LETTER_FA => Ok(Lepcha::LetterFa),
            LETTER_FLA => Ok(Lepcha::LetterFla),
            LETTER_BA => Ok(Lepcha::LetterBa),
            LETTER_BLA => Ok(Lepcha::LetterBla),
            LETTER_MA => Ok(Lepcha::LetterMa),
            LETTER_MLA => Ok(Lepcha::LetterMla),
            LETTER_TSA => Ok(Lepcha::LetterTsa),
            LETTER_TSHA => Ok(Lepcha::LetterTsha),
            LETTER_DZA => Ok(Lepcha::LetterDza),
            LETTER_YA => Ok(Lepcha::LetterYa),
            LETTER_RA => Ok(Lepcha::LetterRa),
            LETTER_LA => Ok(Lepcha::LetterLa),
            LETTER_HA => Ok(Lepcha::LetterHa),
            LETTER_HLA => Ok(Lepcha::LetterHla),
            LETTER_VA => Ok(Lepcha::LetterVa),
            LETTER_SA => Ok(Lepcha::LetterSa),
            LETTER_SHA => Ok(Lepcha::LetterSha),
            LETTER_WA => Ok(Lepcha::LetterWa),
            LETTER_A => Ok(Lepcha::LetterA),
            SUBJOINED_LETTER_YA => Ok(Lepcha::SubjoinedLetterYa),
            SUBJOINED_LETTER_RA => Ok(Lepcha::SubjoinedLetterRa),
            VOWEL_SIGN_AA => Ok(Lepcha::VowelSignAa),
            VOWEL_SIGN_I => Ok(Lepcha::VowelSignI),
            VOWEL_SIGN_O => Ok(Lepcha::VowelSignO),
            VOWEL_SIGN_OO => Ok(Lepcha::VowelSignOo),
            VOWEL_SIGN_U => Ok(Lepcha::VowelSignU),
            VOWEL_SIGN_UU => Ok(Lepcha::VowelSignUu),
            VOWEL_SIGN_E => Ok(Lepcha::VowelSignE),
            CONSONANT_SIGN_K => Ok(Lepcha::ConsonantSignK),
            CONSONANT_SIGN_M => Ok(Lepcha::ConsonantSignM),
            CONSONANT_SIGN_L => Ok(Lepcha::ConsonantSignL),
            CONSONANT_SIGN_N => Ok(Lepcha::ConsonantSignN),
            CONSONANT_SIGN_P => Ok(Lepcha::ConsonantSignP),
            CONSONANT_SIGN_R => Ok(Lepcha::ConsonantSignR),
            CONSONANT_SIGN_T => Ok(Lepcha::ConsonantSignT),
            CONSONANT_SIGN_NYIN_DASH_DO => Ok(Lepcha::ConsonantSignNyinDashDo),
            CONSONANT_SIGN_KANG => Ok(Lepcha::ConsonantSignKang),
            SIGN_RAN => Ok(Lepcha::SignRan),
            SIGN_NUKTA => Ok(Lepcha::SignNukta),
            PUNCTUATION_TA_DASH_ROL => Ok(Lepcha::PunctuationTaDashRol),
            PUNCTUATION_NYET_THYOOM_TA_DASH_ROL => Ok(Lepcha::PunctuationNyetThyoomTaDashRol),
            PUNCTUATION_CER_DASH_WA => Ok(Lepcha::PunctuationCerDashWa),
            PUNCTUATION_TSHOOK_CER_DASH_WA => Ok(Lepcha::PunctuationTshookCerDashWa),
            PUNCTUATION_TSHOOK => Ok(Lepcha::PunctuationTshook),
            DIGIT_ZERO => Ok(Lepcha::DigitZero),
            DIGIT_ONE => Ok(Lepcha::DigitOne),
            DIGIT_TWO => Ok(Lepcha::DigitTwo),
            DIGIT_THREE => Ok(Lepcha::DigitThree),
            DIGIT_FOUR => Ok(Lepcha::DigitFour),
            DIGIT_FIVE => Ok(Lepcha::DigitFive),
            DIGIT_SIX => Ok(Lepcha::DigitSix),
            DIGIT_SEVEN => Ok(Lepcha::DigitSeven),
            DIGIT_EIGHT => Ok(Lepcha::DigitEight),
            DIGIT_NINE => Ok(Lepcha::DigitNine),
            LETTER_TTA => Ok(Lepcha::LetterTta),
            LETTER_TTHA => Ok(Lepcha::LetterTtha),
            _ => Err(()),
        }
    }
}

impl Into<u32> for Lepcha {
    fn into(self) -> u32 {
        let c: char = self.into();
        let hex = c
            .escape_unicode()
            .to_string()
            .replace("\\u{", "")
            .replace("}", "");
        u32::from_str_radix(&hex, 16).unwrap()
    }
}

impl std::convert::TryFrom<u32> for Lepcha {
    type Error = ();
    fn try_from(u: u32) -> Result<Self, Self::Error> {
        if let Ok(c) = char::try_from(u) {
            Self::try_from(c)
        } else {
            Err(())
        }
    }
}

impl Iterator for Lepcha {
    type Item = Self;
    fn next(&mut self) -> Option<Self> {
        let index: u32 = (*self).into();
        use std::convert::TryFrom;
        Self::try_from(index + 1).ok()
    }
}

impl Lepcha {
    /// The character with the lowest index in this unicode block
    pub fn new() -> Self {
        Lepcha::LetterKa
    }

    /// The character's name, all lowercase and space-separated
    pub fn name(&self) -> &str {
        match self {
            Lepcha::LetterKa => "lepcha letter ka",
            Lepcha::LetterKla => "lepcha letter kla",
            Lepcha::LetterKha => "lepcha letter kha",
            Lepcha::LetterGa => "lepcha letter ga",
            Lepcha::LetterGla => "lepcha letter gla",
            Lepcha::LetterNga => "lepcha letter nga",
            Lepcha::LetterCa => "lepcha letter ca",
            Lepcha::LetterCha => "lepcha letter cha",
            Lepcha::LetterJa => "lepcha letter ja",
            Lepcha::LetterNya => "lepcha letter nya",
            Lepcha::LetterTa => "lepcha letter ta",
            Lepcha::LetterTha => "lepcha letter tha",
            Lepcha::LetterDa => "lepcha letter da",
            Lepcha::LetterNa => "lepcha letter na",
            Lepcha::LetterPa => "lepcha letter pa",
            Lepcha::LetterPla => "lepcha letter pla",
            Lepcha::LetterPha => "lepcha letter pha",
            Lepcha::LetterFa => "lepcha letter fa",
            Lepcha::LetterFla => "lepcha letter fla",
            Lepcha::LetterBa => "lepcha letter ba",
            Lepcha::LetterBla => "lepcha letter bla",
            Lepcha::LetterMa => "lepcha letter ma",
            Lepcha::LetterMla => "lepcha letter mla",
            Lepcha::LetterTsa => "lepcha letter tsa",
            Lepcha::LetterTsha => "lepcha letter tsha",
            Lepcha::LetterDza => "lepcha letter dza",
            Lepcha::LetterYa => "lepcha letter ya",
            Lepcha::LetterRa => "lepcha letter ra",
            Lepcha::LetterLa => "lepcha letter la",
            Lepcha::LetterHa => "lepcha letter ha",
            Lepcha::LetterHla => "lepcha letter hla",
            Lepcha::LetterVa => "lepcha letter va",
            Lepcha::LetterSa => "lepcha letter sa",
            Lepcha::LetterSha => "lepcha letter sha",
            Lepcha::LetterWa => "lepcha letter wa",
            Lepcha::LetterA => "lepcha letter a",
            Lepcha::SubjoinedLetterYa => "lepcha subjoined letter ya",
            Lepcha::SubjoinedLetterRa => "lepcha subjoined letter ra",
            Lepcha::VowelSignAa => "lepcha vowel sign aa",
            Lepcha::VowelSignI => "lepcha vowel sign i",
            Lepcha::VowelSignO => "lepcha vowel sign o",
            Lepcha::VowelSignOo => "lepcha vowel sign oo",
            Lepcha::VowelSignU => "lepcha vowel sign u",
            Lepcha::VowelSignUu => "lepcha vowel sign uu",
            Lepcha::VowelSignE => "lepcha vowel sign e",
            Lepcha::ConsonantSignK => "lepcha consonant sign k",
            Lepcha::ConsonantSignM => "lepcha consonant sign m",
            Lepcha::ConsonantSignL => "lepcha consonant sign l",
            Lepcha::ConsonantSignN => "lepcha consonant sign n",
            Lepcha::ConsonantSignP => "lepcha consonant sign p",
            Lepcha::ConsonantSignR => "lepcha consonant sign r",
            Lepcha::ConsonantSignT => "lepcha consonant sign t",
            Lepcha::ConsonantSignNyinDashDo => "lepcha consonant sign nyin-do",
            Lepcha::ConsonantSignKang => "lepcha consonant sign kang",
            Lepcha::SignRan => "lepcha sign ran",
            Lepcha::SignNukta => "lepcha sign nukta",
            Lepcha::PunctuationTaDashRol => "lepcha punctuation ta-rol",
            Lepcha::PunctuationNyetThyoomTaDashRol => "lepcha punctuation nyet thyoom ta-rol",
            Lepcha::PunctuationCerDashWa => "lepcha punctuation cer-wa",
            Lepcha::PunctuationTshookCerDashWa => "lepcha punctuation tshook cer-wa",
            Lepcha::PunctuationTshook => "lepcha punctuation tshook",
            Lepcha::DigitZero => "lepcha digit zero",
            Lepcha::DigitOne => "lepcha digit one",
            Lepcha::DigitTwo => "lepcha digit two",
            Lepcha::DigitThree => "lepcha digit three",
            Lepcha::DigitFour => "lepcha digit four",
            Lepcha::DigitFive => "lepcha digit five",
            Lepcha::DigitSix => "lepcha digit six",
            Lepcha::DigitSeven => "lepcha digit seven",
            Lepcha::DigitEight => "lepcha digit eight",
            Lepcha::DigitNine => "lepcha digit nine",
            Lepcha::LetterTta => "lepcha letter tta",
            Lepcha::LetterTtha => "lepcha letter ttha",
        }
    }
}