1
2#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
4pub enum Duployan {
5    LetterH,
7    LetterX,
9    LetterP,
11    LetterT,
13    LetterF,
15    LetterK,
17    LetterL,
19    LetterB,
21    LetterD,
23    LetterV,
25    LetterG,
27    LetterR,
29    LetterPN,
31    LetterDS,
33    LetterFN,
35    LetterKM,
37    LetterRS,
39    LetterTh,
41    LetterSloanDh,
43    LetterDh,
45    LetterKk,
47    LetterSloanJ,
49    LetterHl,
51    LetterLh,
53    LetterRh,
55    LetterM,
57    LetterN,
59    LetterJ,
61    LetterS,
63    LetterMN,
65    LetterNM,
67    LetterJM,
69    LetterSJ,
71    LetterMWithDot,
73    LetterNWithDot,
75    LetterJWithDot,
77    LetterJWithDotsInsideAndAbove,
79    LetterSWithDot,
81    LetterSWithDotBelow,
83    LetterMS,
85    LetterNS,
87    LetterJS,
89    LetterSS,
91    LetterMNS,
93    LetterNMS,
95    LetterJMS,
97    LetterSJS,
99    LetterJSWithDot,
101    LetterJN,
103    LetterJNS,
105    LetterST,
107    LetterSTR,
109    LetterSP,
111    LetterSPR,
113    LetterTS,
115    LetterTRS,
117    LetterW,
119    LetterWh,
121    LetterWR,
123    LetterSN,
125    LetterSM,
127    LetterKRS,
129    LetterGRS,
131    LetterSK,
133    LetterSKR,
135    LetterA,
137    LetterSloanOw,
139    LetterOa,
141    LetterO,
143    LetterAou,
145    LetterI,
147    LetterE,
149    LetterIe,
151    LetterShortI,
153    LetterUi,
155    LetterEe,
157    LetterSloanEh,
159    LetterRomanianI,
161    LetterSloanEe,
163    LetterLongI,
165    LetterYe,
167    LetterU,
169    LetterEu,
171    LetterXw,
173    LetterUN,
175    LetterLongU,
177    LetterRomanianU,
179    LetterUh,
181    LetterSloanU,
183    LetterOoh,
185    LetterOw,
187    LetterOu,
189    LetterWa,
191    LetterWo,
193    LetterWi,
195    LetterWei,
197    LetterWow,
199    LetterNasalU,
201    LetterNasalO,
203    LetterNasalI,
205    LetterNasalA,
207    LetterPerninAn,
209    LetterPerninAm,
211    LetterSloanEn,
213    LetterSloanAn,
215    LetterSloanOn,
217    LetterVocalicM,
219    AffixLeftHorizontalSecant,
221    AffixMidHorizontalSecant,
223    AffixRightHorizontalSecant,
225    AffixLowVerticalSecant,
227    AffixMidVerticalSecant,
229    AffixHighVerticalSecant,
231    AffixAttachedSecant,
233    AffixAttachedLeftDashToDashRightSecant,
235    AffixAttachedTangent,
237    AffixAttachedTail,
239    AffixAttachedEHook,
241    AffixAttachedIHook,
243    AffixAttachedTangentHook,
245    AffixHighAcute,
247    AffixHighTightAcute,
249    AffixHighGrave,
251    AffixHighLongGrave,
253    AffixHighDot,
255    AffixHighCircle,
257    AffixHighLine,
259    AffixHighWave,
261    AffixHighVertical,
263    AffixLowAcute,
265    AffixLowTightAcute,
267    AffixLowGrave,
269    AffixLowLongGrave,
271    AffixLowDot,
273    AffixLowCircle,
275    AffixLowLine,
277    AffixLowWave,
279    AffixLowVertical,
281    AffixLowArrow,
283    SignOWithCross,
285    ThickLetterSelector,
287    DoubleMark,
289}
290
291impl Into<char> for Duployan {
292    fn into(self) -> char {
293        match self {
294            Duployan::LetterH => '𛰀',
295            Duployan::LetterX => '𛰁',
296            Duployan::LetterP => '𛰂',
297            Duployan::LetterT => '𛰃',
298            Duployan::LetterF => '𛰄',
299            Duployan::LetterK => '𛰅',
300            Duployan::LetterL => '𛰆',
301            Duployan::LetterB => '𛰇',
302            Duployan::LetterD => '𛰈',
303            Duployan::LetterV => '𛰉',
304            Duployan::LetterG => '𛰊',
305            Duployan::LetterR => '𛰋',
306            Duployan::LetterPN => '𛰌',
307            Duployan::LetterDS => '𛰍',
308            Duployan::LetterFN => '𛰎',
309            Duployan::LetterKM => '𛰏',
310            Duployan::LetterRS => '𛰐',
311            Duployan::LetterTh => '𛰑',
312            Duployan::LetterSloanDh => '𛰒',
313            Duployan::LetterDh => '𛰓',
314            Duployan::LetterKk => '𛰔',
315            Duployan::LetterSloanJ => '𛰕',
316            Duployan::LetterHl => '𛰖',
317            Duployan::LetterLh => '𛰗',
318            Duployan::LetterRh => '𛰘',
319            Duployan::LetterM => '𛰙',
320            Duployan::LetterN => '𛰚',
321            Duployan::LetterJ => '𛰛',
322            Duployan::LetterS => '𛰜',
323            Duployan::LetterMN => '𛰝',
324            Duployan::LetterNM => '𛰞',
325            Duployan::LetterJM => '𛰟',
326            Duployan::LetterSJ => '𛰠',
327            Duployan::LetterMWithDot => '𛰡',
328            Duployan::LetterNWithDot => '𛰢',
329            Duployan::LetterJWithDot => '𛰣',
330            Duployan::LetterJWithDotsInsideAndAbove => '𛰤',
331            Duployan::LetterSWithDot => '𛰥',
332            Duployan::LetterSWithDotBelow => '𛰦',
333            Duployan::LetterMS => '𛰧',
334            Duployan::LetterNS => '𛰨',
335            Duployan::LetterJS => '𛰩',
336            Duployan::LetterSS => '𛰪',
337            Duployan::LetterMNS => '𛰫',
338            Duployan::LetterNMS => '𛰬',
339            Duployan::LetterJMS => '𛰭',
340            Duployan::LetterSJS => '𛰮',
341            Duployan::LetterJSWithDot => '𛰯',
342            Duployan::LetterJN => '𛰰',
343            Duployan::LetterJNS => '𛰱',
344            Duployan::LetterST => '𛰲',
345            Duployan::LetterSTR => '𛰳',
346            Duployan::LetterSP => '𛰴',
347            Duployan::LetterSPR => '𛰵',
348            Duployan::LetterTS => '𛰶',
349            Duployan::LetterTRS => '𛰷',
350            Duployan::LetterW => '𛰸',
351            Duployan::LetterWh => '𛰹',
352            Duployan::LetterWR => '𛰺',
353            Duployan::LetterSN => '𛰻',
354            Duployan::LetterSM => '𛰼',
355            Duployan::LetterKRS => '𛰽',
356            Duployan::LetterGRS => '𛰾',
357            Duployan::LetterSK => '𛰿',
358            Duployan::LetterSKR => '𛱀',
359            Duployan::LetterA => '𛱁',
360            Duployan::LetterSloanOw => '𛱂',
361            Duployan::LetterOa => '𛱃',
362            Duployan::LetterO => '𛱄',
363            Duployan::LetterAou => '𛱅',
364            Duployan::LetterI => '𛱆',
365            Duployan::LetterE => '𛱇',
366            Duployan::LetterIe => '𛱈',
367            Duployan::LetterShortI => '𛱉',
368            Duployan::LetterUi => '𛱊',
369            Duployan::LetterEe => '𛱋',
370            Duployan::LetterSloanEh => '𛱌',
371            Duployan::LetterRomanianI => '𛱍',
372            Duployan::LetterSloanEe => '𛱎',
373            Duployan::LetterLongI => '𛱏',
374            Duployan::LetterYe => '𛱐',
375            Duployan::LetterU => '𛱑',
376            Duployan::LetterEu => '𛱒',
377            Duployan::LetterXw => '𛱓',
378            Duployan::LetterUN => '𛱔',
379            Duployan::LetterLongU => '𛱕',
380            Duployan::LetterRomanianU => '𛱖',
381            Duployan::LetterUh => '𛱗',
382            Duployan::LetterSloanU => '𛱘',
383            Duployan::LetterOoh => '𛱙',
384            Duployan::LetterOw => '𛱚',
385            Duployan::LetterOu => '𛱛',
386            Duployan::LetterWa => '𛱜',
387            Duployan::LetterWo => '𛱝',
388            Duployan::LetterWi => '𛱞',
389            Duployan::LetterWei => '𛱟',
390            Duployan::LetterWow => '𛱠',
391            Duployan::LetterNasalU => '𛱡',
392            Duployan::LetterNasalO => '𛱢',
393            Duployan::LetterNasalI => '𛱣',
394            Duployan::LetterNasalA => '𛱤',
395            Duployan::LetterPerninAn => '𛱥',
396            Duployan::LetterPerninAm => '𛱦',
397            Duployan::LetterSloanEn => '𛱧',
398            Duployan::LetterSloanAn => '𛱨',
399            Duployan::LetterSloanOn => '𛱩',
400            Duployan::LetterVocalicM => '𛱪',
401            Duployan::AffixLeftHorizontalSecant => '𛱰',
402            Duployan::AffixMidHorizontalSecant => '𛱱',
403            Duployan::AffixRightHorizontalSecant => '𛱲',
404            Duployan::AffixLowVerticalSecant => '𛱳',
405            Duployan::AffixMidVerticalSecant => '𛱴',
406            Duployan::AffixHighVerticalSecant => '𛱵',
407            Duployan::AffixAttachedSecant => '𛱶',
408            Duployan::AffixAttachedLeftDashToDashRightSecant => '𛱷',
409            Duployan::AffixAttachedTangent => '𛱸',
410            Duployan::AffixAttachedTail => '𛱹',
411            Duployan::AffixAttachedEHook => '𛱺',
412            Duployan::AffixAttachedIHook => '𛱻',
413            Duployan::AffixAttachedTangentHook => '𛱼',
414            Duployan::AffixHighAcute => '𛲀',
415            Duployan::AffixHighTightAcute => '𛲁',
416            Duployan::AffixHighGrave => '𛲂',
417            Duployan::AffixHighLongGrave => '𛲃',
418            Duployan::AffixHighDot => '𛲄',
419            Duployan::AffixHighCircle => '𛲅',
420            Duployan::AffixHighLine => '𛲆',
421            Duployan::AffixHighWave => '𛲇',
422            Duployan::AffixHighVertical => '𛲈',
423            Duployan::AffixLowAcute => '𛲐',
424            Duployan::AffixLowTightAcute => '𛲑',
425            Duployan::AffixLowGrave => '𛲒',
426            Duployan::AffixLowLongGrave => '𛲓',
427            Duployan::AffixLowDot => '𛲔',
428            Duployan::AffixLowCircle => '𛲕',
429            Duployan::AffixLowLine => '𛲖',
430            Duployan::AffixLowWave => '𛲗',
431            Duployan::AffixLowVertical => '𛲘',
432            Duployan::AffixLowArrow => '𛲙',
433            Duployan::SignOWithCross => '𛲜',
434            Duployan::ThickLetterSelector => '𛲝',
435            Duployan::DoubleMark => '𛲞',
436        }
437    }
438}
439
440impl std::convert::TryFrom<char> for Duployan {
441    type Error = ();
442    fn try_from(c: char) -> Result<Self, Self::Error> {
443        match c {
444            '𛰀' => Ok(Duployan::LetterH),
445            '𛰁' => Ok(Duployan::LetterX),
446            '𛰂' => Ok(Duployan::LetterP),
447            '𛰃' => Ok(Duployan::LetterT),
448            '𛰄' => Ok(Duployan::LetterF),
449            '𛰅' => Ok(Duployan::LetterK),
450            '𛰆' => Ok(Duployan::LetterL),
451            '𛰇' => Ok(Duployan::LetterB),
452            '𛰈' => Ok(Duployan::LetterD),
453            '𛰉' => Ok(Duployan::LetterV),
454            '𛰊' => Ok(Duployan::LetterG),
455            '𛰋' => Ok(Duployan::LetterR),
456            '𛰌' => Ok(Duployan::LetterPN),
457            '𛰍' => Ok(Duployan::LetterDS),
458            '𛰎' => Ok(Duployan::LetterFN),
459            '𛰏' => Ok(Duployan::LetterKM),
460            '𛰐' => Ok(Duployan::LetterRS),
461            '𛰑' => Ok(Duployan::LetterTh),
462            '𛰒' => Ok(Duployan::LetterSloanDh),
463            '𛰓' => Ok(Duployan::LetterDh),
464            '𛰔' => Ok(Duployan::LetterKk),
465            '𛰕' => Ok(Duployan::LetterSloanJ),
466            '𛰖' => Ok(Duployan::LetterHl),
467            '𛰗' => Ok(Duployan::LetterLh),
468            '𛰘' => Ok(Duployan::LetterRh),
469            '𛰙' => Ok(Duployan::LetterM),
470            '𛰚' => Ok(Duployan::LetterN),
471            '𛰛' => Ok(Duployan::LetterJ),
472            '𛰜' => Ok(Duployan::LetterS),
473            '𛰝' => Ok(Duployan::LetterMN),
474            '𛰞' => Ok(Duployan::LetterNM),
475            '𛰟' => Ok(Duployan::LetterJM),
476            '𛰠' => Ok(Duployan::LetterSJ),
477            '𛰡' => Ok(Duployan::LetterMWithDot),
478            '𛰢' => Ok(Duployan::LetterNWithDot),
479            '𛰣' => Ok(Duployan::LetterJWithDot),
480            '𛰤' => Ok(Duployan::LetterJWithDotsInsideAndAbove),
481            '𛰥' => Ok(Duployan::LetterSWithDot),
482            '𛰦' => Ok(Duployan::LetterSWithDotBelow),
483            '𛰧' => Ok(Duployan::LetterMS),
484            '𛰨' => Ok(Duployan::LetterNS),
485            '𛰩' => Ok(Duployan::LetterJS),
486            '𛰪' => Ok(Duployan::LetterSS),
487            '𛰫' => Ok(Duployan::LetterMNS),
488            '𛰬' => Ok(Duployan::LetterNMS),
489            '𛰭' => Ok(Duployan::LetterJMS),
490            '𛰮' => Ok(Duployan::LetterSJS),
491            '𛰯' => Ok(Duployan::LetterJSWithDot),
492            '𛰰' => Ok(Duployan::LetterJN),
493            '𛰱' => Ok(Duployan::LetterJNS),
494            '𛰲' => Ok(Duployan::LetterST),
495            '𛰳' => Ok(Duployan::LetterSTR),
496            '𛰴' => Ok(Duployan::LetterSP),
497            '𛰵' => Ok(Duployan::LetterSPR),
498            '𛰶' => Ok(Duployan::LetterTS),
499            '𛰷' => Ok(Duployan::LetterTRS),
500            '𛰸' => Ok(Duployan::LetterW),
501            '𛰹' => Ok(Duployan::LetterWh),
502            '𛰺' => Ok(Duployan::LetterWR),
503            '𛰻' => Ok(Duployan::LetterSN),
504            '𛰼' => Ok(Duployan::LetterSM),
505            '𛰽' => Ok(Duployan::LetterKRS),
506            '𛰾' => Ok(Duployan::LetterGRS),
507            '𛰿' => Ok(Duployan::LetterSK),
508            '𛱀' => Ok(Duployan::LetterSKR),
509            '𛱁' => Ok(Duployan::LetterA),
510            '𛱂' => Ok(Duployan::LetterSloanOw),
511            '𛱃' => Ok(Duployan::LetterOa),
512            '𛱄' => Ok(Duployan::LetterO),
513            '𛱅' => Ok(Duployan::LetterAou),
514            '𛱆' => Ok(Duployan::LetterI),
515            '𛱇' => Ok(Duployan::LetterE),
516            '𛱈' => Ok(Duployan::LetterIe),
517            '𛱉' => Ok(Duployan::LetterShortI),
518            '𛱊' => Ok(Duployan::LetterUi),
519            '𛱋' => Ok(Duployan::LetterEe),
520            '𛱌' => Ok(Duployan::LetterSloanEh),
521            '𛱍' => Ok(Duployan::LetterRomanianI),
522            '𛱎' => Ok(Duployan::LetterSloanEe),
523            '𛱏' => Ok(Duployan::LetterLongI),
524            '𛱐' => Ok(Duployan::LetterYe),
525            '𛱑' => Ok(Duployan::LetterU),
526            '𛱒' => Ok(Duployan::LetterEu),
527            '𛱓' => Ok(Duployan::LetterXw),
528            '𛱔' => Ok(Duployan::LetterUN),
529            '𛱕' => Ok(Duployan::LetterLongU),
530            '𛱖' => Ok(Duployan::LetterRomanianU),
531            '𛱗' => Ok(Duployan::LetterUh),
532            '𛱘' => Ok(Duployan::LetterSloanU),
533            '𛱙' => Ok(Duployan::LetterOoh),
534            '𛱚' => Ok(Duployan::LetterOw),
535            '𛱛' => Ok(Duployan::LetterOu),
536            '𛱜' => Ok(Duployan::LetterWa),
537            '𛱝' => Ok(Duployan::LetterWo),
538            '𛱞' => Ok(Duployan::LetterWi),
539            '𛱟' => Ok(Duployan::LetterWei),
540            '𛱠' => Ok(Duployan::LetterWow),
541            '𛱡' => Ok(Duployan::LetterNasalU),
542            '𛱢' => Ok(Duployan::LetterNasalO),
543            '𛱣' => Ok(Duployan::LetterNasalI),
544            '𛱤' => Ok(Duployan::LetterNasalA),
545            '𛱥' => Ok(Duployan::LetterPerninAn),
546            '𛱦' => Ok(Duployan::LetterPerninAm),
547            '𛱧' => Ok(Duployan::LetterSloanEn),
548            '𛱨' => Ok(Duployan::LetterSloanAn),
549            '𛱩' => Ok(Duployan::LetterSloanOn),
550            '𛱪' => Ok(Duployan::LetterVocalicM),
551            '𛱰' => Ok(Duployan::AffixLeftHorizontalSecant),
552            '𛱱' => Ok(Duployan::AffixMidHorizontalSecant),
553            '𛱲' => Ok(Duployan::AffixRightHorizontalSecant),
554            '𛱳' => Ok(Duployan::AffixLowVerticalSecant),
555            '𛱴' => Ok(Duployan::AffixMidVerticalSecant),
556            '𛱵' => Ok(Duployan::AffixHighVerticalSecant),
557            '𛱶' => Ok(Duployan::AffixAttachedSecant),
558            '𛱷' => Ok(Duployan::AffixAttachedLeftDashToDashRightSecant),
559            '𛱸' => Ok(Duployan::AffixAttachedTangent),
560            '𛱹' => Ok(Duployan::AffixAttachedTail),
561            '𛱺' => Ok(Duployan::AffixAttachedEHook),
562            '𛱻' => Ok(Duployan::AffixAttachedIHook),
563            '𛱼' => Ok(Duployan::AffixAttachedTangentHook),
564            '𛲀' => Ok(Duployan::AffixHighAcute),
565            '𛲁' => Ok(Duployan::AffixHighTightAcute),
566            '𛲂' => Ok(Duployan::AffixHighGrave),
567            '𛲃' => Ok(Duployan::AffixHighLongGrave),
568            '𛲄' => Ok(Duployan::AffixHighDot),
569            '𛲅' => Ok(Duployan::AffixHighCircle),
570            '𛲆' => Ok(Duployan::AffixHighLine),
571            '𛲇' => Ok(Duployan::AffixHighWave),
572            '𛲈' => Ok(Duployan::AffixHighVertical),
573            '𛲐' => Ok(Duployan::AffixLowAcute),
574            '𛲑' => Ok(Duployan::AffixLowTightAcute),
575            '𛲒' => Ok(Duployan::AffixLowGrave),
576            '𛲓' => Ok(Duployan::AffixLowLongGrave),
577            '𛲔' => Ok(Duployan::AffixLowDot),
578            '𛲕' => Ok(Duployan::AffixLowCircle),
579            '𛲖' => Ok(Duployan::AffixLowLine),
580            '𛲗' => Ok(Duployan::AffixLowWave),
581            '𛲘' => Ok(Duployan::AffixLowVertical),
582            '𛲙' => Ok(Duployan::AffixLowArrow),
583            '𛲜' => Ok(Duployan::SignOWithCross),
584            '𛲝' => Ok(Duployan::ThickLetterSelector),
585            '𛲞' => Ok(Duployan::DoubleMark),
586            _ => Err(()),
587        }
588    }
589}
590
591impl Into<u32> for Duployan {
592    fn into(self) -> u32 {
593        let c: char = self.into();
594        let hex = c
595            .escape_unicode()
596            .to_string()
597            .replace("\\u{", "")
598            .replace("}", "");
599        u32::from_str_radix(&hex, 16).unwrap()
600    }
601}
602
603impl std::convert::TryFrom<u32> for Duployan {
604    type Error = ();
605    fn try_from(u: u32) -> Result<Self, Self::Error> {
606        if let Ok(c) = char::try_from(u) {
607            Self::try_from(c)
608        } else {
609            Err(())
610        }
611    }
612}
613
614impl Iterator for Duployan {
615    type Item = Self;
616    fn next(&mut self) -> Option<Self> {
617        let index: u32 = (*self).into();
618        use std::convert::TryFrom;
619        Self::try_from(index + 1).ok()
620    }
621}
622
623impl Duployan {
624    pub fn new() -> Self {
626        Duployan::LetterH
627    }
628
629    pub fn name(&self) -> String {
631        let s = std::format!("Duployan{:#?}", self);
632        string_morph::to_sentence_case(&s)
633    }
634}