#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum BassaVah {
LetterEnni,
LetterKa,
LetterSe,
LetterFa,
LetterMbe,
LetterYie,
LetterGah,
LetterDhii,
LetterKpah,
LetterJo,
LetterHwah,
LetterWa,
LetterZo,
LetterGbu,
LetterDo,
LetterCe,
LetterUwu,
LetterTo,
LetterBa,
LetterVu,
LetterYein,
LetterPa,
LetterWadda,
LetterA,
LetterO,
LetterOo,
LetterU,
LetterEe,
LetterE,
LetterI,
CombiningHighTone,
CombiningLowTone,
CombiningMidTone,
CombiningLowDashMidTone,
CombiningHighDashLowTone,
FullStop,
}
impl Into<char> for BassaVah {
fn into(self) -> char {
match self {
BassaVah::LetterEnni => '𖫐',
BassaVah::LetterKa => '𖫑',
BassaVah::LetterSe => '𖫒',
BassaVah::LetterFa => '𖫓',
BassaVah::LetterMbe => '𖫔',
BassaVah::LetterYie => '𖫕',
BassaVah::LetterGah => '𖫖',
BassaVah::LetterDhii => '𖫗',
BassaVah::LetterKpah => '𖫘',
BassaVah::LetterJo => '𖫙',
BassaVah::LetterHwah => '𖫚',
BassaVah::LetterWa => '𖫛',
BassaVah::LetterZo => '𖫜',
BassaVah::LetterGbu => '𖫝',
BassaVah::LetterDo => '𖫞',
BassaVah::LetterCe => '𖫟',
BassaVah::LetterUwu => '𖫠',
BassaVah::LetterTo => '𖫡',
BassaVah::LetterBa => '𖫢',
BassaVah::LetterVu => '𖫣',
BassaVah::LetterYein => '𖫤',
BassaVah::LetterPa => '𖫥',
BassaVah::LetterWadda => '𖫦',
BassaVah::LetterA => '𖫧',
BassaVah::LetterO => '𖫨',
BassaVah::LetterOo => '𖫩',
BassaVah::LetterU => '𖫪',
BassaVah::LetterEe => '𖫫',
BassaVah::LetterE => '𖫬',
BassaVah::LetterI => '𖫭',
BassaVah::CombiningHighTone => '𖫰',
BassaVah::CombiningLowTone => '𖫱',
BassaVah::CombiningMidTone => '𖫲',
BassaVah::CombiningLowDashMidTone => '𖫳',
BassaVah::CombiningHighDashLowTone => '𖫴',
BassaVah::FullStop => '𖫵',
}
}
}
impl std::convert::TryFrom<char> for BassaVah {
type Error = ();
fn try_from(c: char) -> Result<Self, Self::Error> {
match c {
'𖫐' => Ok(BassaVah::LetterEnni),
'𖫑' => Ok(BassaVah::LetterKa),
'𖫒' => Ok(BassaVah::LetterSe),
'𖫓' => Ok(BassaVah::LetterFa),
'𖫔' => Ok(BassaVah::LetterMbe),
'𖫕' => Ok(BassaVah::LetterYie),
'𖫖' => Ok(BassaVah::LetterGah),
'𖫗' => Ok(BassaVah::LetterDhii),
'𖫘' => Ok(BassaVah::LetterKpah),
'𖫙' => Ok(BassaVah::LetterJo),
'𖫚' => Ok(BassaVah::LetterHwah),
'𖫛' => Ok(BassaVah::LetterWa),
'𖫜' => Ok(BassaVah::LetterZo),
'𖫝' => Ok(BassaVah::LetterGbu),
'𖫞' => Ok(BassaVah::LetterDo),
'𖫟' => Ok(BassaVah::LetterCe),
'𖫠' => Ok(BassaVah::LetterUwu),
'𖫡' => Ok(BassaVah::LetterTo),
'𖫢' => Ok(BassaVah::LetterBa),
'𖫣' => Ok(BassaVah::LetterVu),
'𖫤' => Ok(BassaVah::LetterYein),
'𖫥' => Ok(BassaVah::LetterPa),
'𖫦' => Ok(BassaVah::LetterWadda),
'𖫧' => Ok(BassaVah::LetterA),
'𖫨' => Ok(BassaVah::LetterO),
'𖫩' => Ok(BassaVah::LetterOo),
'𖫪' => Ok(BassaVah::LetterU),
'𖫫' => Ok(BassaVah::LetterEe),
'𖫬' => Ok(BassaVah::LetterE),
'𖫭' => Ok(BassaVah::LetterI),
'𖫰' => Ok(BassaVah::CombiningHighTone),
'𖫱' => Ok(BassaVah::CombiningLowTone),
'𖫲' => Ok(BassaVah::CombiningMidTone),
'𖫳' => Ok(BassaVah::CombiningLowDashMidTone),
'𖫴' => Ok(BassaVah::CombiningHighDashLowTone),
'𖫵' => Ok(BassaVah::FullStop),
_ => Err(()),
}
}
}
impl Into<u32> for BassaVah {
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 BassaVah {
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 BassaVah {
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 BassaVah {
pub fn new() -> Self {
BassaVah::LetterEnni
}
pub fn name(&self) -> String {
let s = std::format!("BassaVah{:#?}", self);
string_morph::to_sentence_case(&s)
}
}