mod constants {
pub const DIGIT_ZERO: char = '᱐';
pub const DIGIT_ONE: char = '᱑';
pub const DIGIT_TWO: char = '᱒';
pub const DIGIT_THREE: char = '᱓';
pub const DIGIT_FOUR: char = '᱔';
pub const DIGIT_FIVE: char = '᱕';
pub const DIGIT_SIX: char = '᱖';
pub const DIGIT_SEVEN: char = '᱗';
pub const DIGIT_EIGHT: char = '᱘';
pub const DIGIT_NINE: char = '᱙';
pub const LETTER_LA: char = 'ᱚ';
pub const LETTER_AT: char = 'ᱛ';
pub const LETTER_AG: char = 'ᱜ';
pub const LETTER_ANG: char = 'ᱝ';
pub const LETTER_AL: char = 'ᱞ';
pub const LETTER_LAA: char = 'ᱟ';
pub const LETTER_AAK: char = 'ᱠ';
pub const LETTER_AAJ: char = 'ᱡ';
pub const LETTER_AAM: char = 'ᱢ';
pub const LETTER_AAW: char = 'ᱣ';
pub const LETTER_LI: char = 'ᱤ';
pub const LETTER_IS: char = 'ᱥ';
pub const LETTER_IH: char = 'ᱦ';
pub const LETTER_INY: char = 'ᱧ';
pub const LETTER_IR: char = 'ᱨ';
pub const LETTER_LU: char = 'ᱩ';
pub const LETTER_UC: char = 'ᱪ';
pub const LETTER_UD: char = 'ᱫ';
pub const LETTER_UNN: char = 'ᱬ';
pub const LETTER_UY: char = 'ᱭ';
pub const LETTER_LE: char = 'ᱮ';
pub const LETTER_EP: char = 'ᱯ';
pub const LETTER_EDD: char = 'ᱰ';
pub const LETTER_EN: char = 'ᱱ';
pub const LETTER_ERR: char = 'ᱲ';
pub const LETTER_LO: char = 'ᱳ';
pub const LETTER_OTT: char = 'ᱴ';
pub const LETTER_OB: char = 'ᱵ';
pub const LETTER_OV: char = 'ᱶ';
pub const LETTER_OH: char = 'ᱷ';
pub const MU_TTUDDAG: char = 'ᱸ';
pub const GAAHLAA_TTUDDAAG: char = 'ᱹ';
pub const MU_DASH_GAAHLAA_TTUDDAAG: char = 'ᱺ';
pub const RELAA: char = 'ᱻ';
pub const PHAARKAA: char = 'ᱼ';
pub const AHAD: char = 'ᱽ';
pub const PUNCTUATION_MUCAAD: char = '᱾';
}
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum OlChiki {
DigitZero,
DigitOne,
DigitTwo,
DigitThree,
DigitFour,
DigitFive,
DigitSix,
DigitSeven,
DigitEight,
DigitNine,
LetterLa,
LetterAt,
LetterAg,
LetterAng,
LetterAl,
LetterLaa,
LetterAak,
LetterAaj,
LetterAam,
LetterAaw,
LetterLi,
LetterIs,
LetterIh,
LetterIny,
LetterIr,
LetterLu,
LetterUc,
LetterUd,
LetterUnn,
LetterUy,
LetterLe,
LetterEp,
LetterEdd,
LetterEn,
LetterErr,
LetterLo,
LetterOtt,
LetterOb,
LetterOv,
LetterOh,
MuTtuddag,
GaahlaaTtuddaag,
MuDashGaahlaaTtuddaag,
Relaa,
Phaarkaa,
Ahad,
PunctuationMucaad,
}
impl Into<char> for OlChiki {
fn into(self) -> char {
use constants::*;
match self {
OlChiki::DigitZero => DIGIT_ZERO,
OlChiki::DigitOne => DIGIT_ONE,
OlChiki::DigitTwo => DIGIT_TWO,
OlChiki::DigitThree => DIGIT_THREE,
OlChiki::DigitFour => DIGIT_FOUR,
OlChiki::DigitFive => DIGIT_FIVE,
OlChiki::DigitSix => DIGIT_SIX,
OlChiki::DigitSeven => DIGIT_SEVEN,
OlChiki::DigitEight => DIGIT_EIGHT,
OlChiki::DigitNine => DIGIT_NINE,
OlChiki::LetterLa => LETTER_LA,
OlChiki::LetterAt => LETTER_AT,
OlChiki::LetterAg => LETTER_AG,
OlChiki::LetterAng => LETTER_ANG,
OlChiki::LetterAl => LETTER_AL,
OlChiki::LetterLaa => LETTER_LAA,
OlChiki::LetterAak => LETTER_AAK,
OlChiki::LetterAaj => LETTER_AAJ,
OlChiki::LetterAam => LETTER_AAM,
OlChiki::LetterAaw => LETTER_AAW,
OlChiki::LetterLi => LETTER_LI,
OlChiki::LetterIs => LETTER_IS,
OlChiki::LetterIh => LETTER_IH,
OlChiki::LetterIny => LETTER_INY,
OlChiki::LetterIr => LETTER_IR,
OlChiki::LetterLu => LETTER_LU,
OlChiki::LetterUc => LETTER_UC,
OlChiki::LetterUd => LETTER_UD,
OlChiki::LetterUnn => LETTER_UNN,
OlChiki::LetterUy => LETTER_UY,
OlChiki::LetterLe => LETTER_LE,
OlChiki::LetterEp => LETTER_EP,
OlChiki::LetterEdd => LETTER_EDD,
OlChiki::LetterEn => LETTER_EN,
OlChiki::LetterErr => LETTER_ERR,
OlChiki::LetterLo => LETTER_LO,
OlChiki::LetterOtt => LETTER_OTT,
OlChiki::LetterOb => LETTER_OB,
OlChiki::LetterOv => LETTER_OV,
OlChiki::LetterOh => LETTER_OH,
OlChiki::MuTtuddag => MU_TTUDDAG,
OlChiki::GaahlaaTtuddaag => GAAHLAA_TTUDDAAG,
OlChiki::MuDashGaahlaaTtuddaag => MU_DASH_GAAHLAA_TTUDDAAG,
OlChiki::Relaa => RELAA,
OlChiki::Phaarkaa => PHAARKAA,
OlChiki::Ahad => AHAD,
OlChiki::PunctuationMucaad => PUNCTUATION_MUCAAD,
}
}
}
impl std::convert::TryFrom<char> for OlChiki {
type Error = ();
fn try_from(c: char) -> Result<Self, Self::Error> {
use constants::*;
match c {
DIGIT_ZERO => Ok(OlChiki::DigitZero),
DIGIT_ONE => Ok(OlChiki::DigitOne),
DIGIT_TWO => Ok(OlChiki::DigitTwo),
DIGIT_THREE => Ok(OlChiki::DigitThree),
DIGIT_FOUR => Ok(OlChiki::DigitFour),
DIGIT_FIVE => Ok(OlChiki::DigitFive),
DIGIT_SIX => Ok(OlChiki::DigitSix),
DIGIT_SEVEN => Ok(OlChiki::DigitSeven),
DIGIT_EIGHT => Ok(OlChiki::DigitEight),
DIGIT_NINE => Ok(OlChiki::DigitNine),
LETTER_LA => Ok(OlChiki::LetterLa),
LETTER_AT => Ok(OlChiki::LetterAt),
LETTER_AG => Ok(OlChiki::LetterAg),
LETTER_ANG => Ok(OlChiki::LetterAng),
LETTER_AL => Ok(OlChiki::LetterAl),
LETTER_LAA => Ok(OlChiki::LetterLaa),
LETTER_AAK => Ok(OlChiki::LetterAak),
LETTER_AAJ => Ok(OlChiki::LetterAaj),
LETTER_AAM => Ok(OlChiki::LetterAam),
LETTER_AAW => Ok(OlChiki::LetterAaw),
LETTER_LI => Ok(OlChiki::LetterLi),
LETTER_IS => Ok(OlChiki::LetterIs),
LETTER_IH => Ok(OlChiki::LetterIh),
LETTER_INY => Ok(OlChiki::LetterIny),
LETTER_IR => Ok(OlChiki::LetterIr),
LETTER_LU => Ok(OlChiki::LetterLu),
LETTER_UC => Ok(OlChiki::LetterUc),
LETTER_UD => Ok(OlChiki::LetterUd),
LETTER_UNN => Ok(OlChiki::LetterUnn),
LETTER_UY => Ok(OlChiki::LetterUy),
LETTER_LE => Ok(OlChiki::LetterLe),
LETTER_EP => Ok(OlChiki::LetterEp),
LETTER_EDD => Ok(OlChiki::LetterEdd),
LETTER_EN => Ok(OlChiki::LetterEn),
LETTER_ERR => Ok(OlChiki::LetterErr),
LETTER_LO => Ok(OlChiki::LetterLo),
LETTER_OTT => Ok(OlChiki::LetterOtt),
LETTER_OB => Ok(OlChiki::LetterOb),
LETTER_OV => Ok(OlChiki::LetterOv),
LETTER_OH => Ok(OlChiki::LetterOh),
MU_TTUDDAG => Ok(OlChiki::MuTtuddag),
GAAHLAA_TTUDDAAG => Ok(OlChiki::GaahlaaTtuddaag),
MU_DASH_GAAHLAA_TTUDDAAG => Ok(OlChiki::MuDashGaahlaaTtuddaag),
RELAA => Ok(OlChiki::Relaa),
PHAARKAA => Ok(OlChiki::Phaarkaa),
AHAD => Ok(OlChiki::Ahad),
PUNCTUATION_MUCAAD => Ok(OlChiki::PunctuationMucaad),
_ => Err(()),
}
}
}
impl Into<u32> for OlChiki {
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 OlChiki {
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 OlChiki {
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 OlChiki {
pub fn new() -> Self {
OlChiki::DigitZero
}
pub fn name(&self) -> &str {
match self {
OlChiki::DigitZero => "ol chiki digit zero",
OlChiki::DigitOne => "ol chiki digit one",
OlChiki::DigitTwo => "ol chiki digit two",
OlChiki::DigitThree => "ol chiki digit three",
OlChiki::DigitFour => "ol chiki digit four",
OlChiki::DigitFive => "ol chiki digit five",
OlChiki::DigitSix => "ol chiki digit six",
OlChiki::DigitSeven => "ol chiki digit seven",
OlChiki::DigitEight => "ol chiki digit eight",
OlChiki::DigitNine => "ol chiki digit nine",
OlChiki::LetterLa => "ol chiki letter la",
OlChiki::LetterAt => "ol chiki letter at",
OlChiki::LetterAg => "ol chiki letter ag",
OlChiki::LetterAng => "ol chiki letter ang",
OlChiki::LetterAl => "ol chiki letter al",
OlChiki::LetterLaa => "ol chiki letter laa",
OlChiki::LetterAak => "ol chiki letter aak",
OlChiki::LetterAaj => "ol chiki letter aaj",
OlChiki::LetterAam => "ol chiki letter aam",
OlChiki::LetterAaw => "ol chiki letter aaw",
OlChiki::LetterLi => "ol chiki letter li",
OlChiki::LetterIs => "ol chiki letter is",
OlChiki::LetterIh => "ol chiki letter ih",
OlChiki::LetterIny => "ol chiki letter iny",
OlChiki::LetterIr => "ol chiki letter ir",
OlChiki::LetterLu => "ol chiki letter lu",
OlChiki::LetterUc => "ol chiki letter uc",
OlChiki::LetterUd => "ol chiki letter ud",
OlChiki::LetterUnn => "ol chiki letter unn",
OlChiki::LetterUy => "ol chiki letter uy",
OlChiki::LetterLe => "ol chiki letter le",
OlChiki::LetterEp => "ol chiki letter ep",
OlChiki::LetterEdd => "ol chiki letter edd",
OlChiki::LetterEn => "ol chiki letter en",
OlChiki::LetterErr => "ol chiki letter err",
OlChiki::LetterLo => "ol chiki letter lo",
OlChiki::LetterOtt => "ol chiki letter ott",
OlChiki::LetterOb => "ol chiki letter ob",
OlChiki::LetterOv => "ol chiki letter ov",
OlChiki::LetterOh => "ol chiki letter oh",
OlChiki::MuTtuddag => "ol chiki mu ttuddag",
OlChiki::GaahlaaTtuddaag => "ol chiki gaahlaa ttuddaag",
OlChiki::MuDashGaahlaaTtuddaag => "ol chiki mu-gaahlaa ttuddaag",
OlChiki::Relaa => "ol chiki relaa",
OlChiki::Phaarkaa => "ol chiki phaarkaa",
OlChiki::Ahad => "ol chiki ahad",
OlChiki::PunctuationMucaad => "ol chiki punctuation mucaad",
}
}
}