#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum MeroiticHieroglyphs {
MeroiticHieroglyphicLetterA,
MeroiticHieroglyphicLetterE,
MeroiticHieroglyphicLetterI,
MeroiticHieroglyphicLetterO,
MeroiticHieroglyphicLetterYa,
MeroiticHieroglyphicLetterWa,
MeroiticHieroglyphicLetterBa,
MeroiticHieroglyphicLetterBaDash2,
MeroiticHieroglyphicLetterPa,
MeroiticHieroglyphicLetterMa,
MeroiticHieroglyphicLetterNa,
MeroiticHieroglyphicLetterNaDash2,
MeroiticHieroglyphicLetterNe,
MeroiticHieroglyphicLetterNeDash2,
MeroiticHieroglyphicLetterRa,
MeroiticHieroglyphicLetterRaDash2,
MeroiticHieroglyphicLetterLa,
MeroiticHieroglyphicLetterKha,
MeroiticHieroglyphicLetterHha,
MeroiticHieroglyphicLetterSa,
MeroiticHieroglyphicLetterSaDash2,
MeroiticHieroglyphicLetterSe,
MeroiticHieroglyphicLetterKa,
MeroiticHieroglyphicLetterQa,
MeroiticHieroglyphicLetterTa,
MeroiticHieroglyphicLetterTaDash2,
MeroiticHieroglyphicLetterTe,
MeroiticHieroglyphicLetterTeDash2,
MeroiticHieroglyphicLetterTo,
MeroiticHieroglyphicLetterDa,
MeroiticHieroglyphicSymbolVidj,
}
impl Into<char> for MeroiticHieroglyphs {
fn into(self) -> char {
match self {
MeroiticHieroglyphs::MeroiticHieroglyphicLetterA => '𐦀',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterE => '𐦁',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterI => '𐦂',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterO => '𐦃',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterYa => '𐦄',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterWa => '𐦅',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterBa => '𐦆',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterBaDash2 => '𐦇',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterPa => '𐦈',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterMa => '𐦉',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterNa => '𐦊',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterNaDash2 => '𐦋',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterNe => '𐦌',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterNeDash2 => '𐦍',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterRa => '𐦎',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterRaDash2 => '𐦏',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterLa => '𐦐',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterKha => '𐦑',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterHha => '𐦒',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterSa => '𐦓',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterSaDash2 => '𐦔',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterSe => '𐦕',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterKa => '𐦖',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterQa => '𐦗',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterTa => '𐦘',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterTaDash2 => '𐦙',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterTe => '𐦚',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterTeDash2 => '𐦛',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterTo => '𐦜',
MeroiticHieroglyphs::MeroiticHieroglyphicLetterDa => '𐦝',
MeroiticHieroglyphs::MeroiticHieroglyphicSymbolVidj => '𐦞',
}
}
}
impl std::convert::TryFrom<char> for MeroiticHieroglyphs {
type Error = ();
fn try_from(c: char) -> Result<Self, Self::Error> {
match c {
'𐦀' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterA),
'𐦁' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterE),
'𐦂' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterI),
'𐦃' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterO),
'𐦄' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterYa),
'𐦅' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterWa),
'𐦆' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterBa),
'𐦇' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterBaDash2),
'𐦈' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterPa),
'𐦉' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterMa),
'𐦊' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterNa),
'𐦋' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterNaDash2),
'𐦌' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterNe),
'𐦍' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterNeDash2),
'𐦎' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterRa),
'𐦏' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterRaDash2),
'𐦐' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterLa),
'𐦑' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterKha),
'𐦒' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterHha),
'𐦓' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterSa),
'𐦔' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterSaDash2),
'𐦕' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterSe),
'𐦖' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterKa),
'𐦗' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterQa),
'𐦘' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterTa),
'𐦙' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterTaDash2),
'𐦚' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterTe),
'𐦛' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterTeDash2),
'𐦜' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterTo),
'𐦝' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicLetterDa),
'𐦞' => Ok(MeroiticHieroglyphs::MeroiticHieroglyphicSymbolVidj),
_ => Err(()),
}
}
}
impl Into<u32> for MeroiticHieroglyphs {
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 MeroiticHieroglyphs {
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 MeroiticHieroglyphs {
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 MeroiticHieroglyphs {
pub fn new() -> Self {
MeroiticHieroglyphs::MeroiticHieroglyphicLetterA
}
pub fn name(&self) -> String {
let s = std::format!("MeroiticHieroglyphs{:#?}", self);
string_morph::to_sentence_case(&s)
}
}