#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum Emoticons {
GrinningFace,
GrinningFaceWithSmilingEyes,
FaceWithTearsOfJoy,
SmilingFaceWithOpenMouth,
SmilingFaceWithOpenMouthAndSmilingEyes,
SmilingFaceWithOpenMouthAndColdSweat,
SmilingFaceWithOpenMouthAndTightlyDashClosedEyes,
SmilingFaceWithHalo,
SmilingFaceWithHorns,
WinkingFace,
SmilingFaceWithSmilingEyes,
FaceSavouringDeliciousFood,
RelievedFace,
SmilingFaceWithHeartDashShapedEyes,
SmilingFaceWithSunglasses,
SmirkingFace,
NeutralFace,
ExpressionlessFace,
UnamusedFace,
FaceWithColdSweat,
PensiveFace,
ConfusedFace,
ConfoundedFace,
KissingFace,
FaceThrowingAKiss,
KissingFaceWithSmilingEyes,
KissingFaceWithClosedEyes,
FaceWithStuckDashOutTongue,
FaceWithStuckDashOutTongueAndWinkingEye,
FaceWithStuckDashOutTongueAndTightlyDashClosedEyes,
DisappointedFace,
WorriedFace,
AngryFace,
PoutingFace,
CryingFace,
PerseveringFace,
FaceWithLookOfTriumph,
DisappointedButRelievedFace,
FrowningFaceWithOpenMouth,
AnguishedFace,
FearfulFace,
WearyFace,
SleepyFace,
TiredFace,
GrimacingFace,
LoudlyCryingFace,
FaceWithOpenMouth,
HushedFace,
FaceWithOpenMouthAndColdSweat,
FaceScreamingInFear,
AstonishedFace,
FlushedFace,
SleepingFace,
DizzyFace,
FaceWithoutMouth,
FaceWithMedicalMask,
GrinningCatFaceWithSmilingEyes,
CatFaceWithTearsOfJoy,
SmilingCatFaceWithOpenMouth,
SmilingCatFaceWithHeartDashShapedEyes,
CatFaceWithWrySmile,
KissingCatFaceWithClosedEyes,
PoutingCatFace,
CryingCatFace,
WearyCatFace,
SlightlyFrowningFace,
SlightlySmilingFace,
UpsideDashDownFace,
FaceWithRollingEyes,
FaceWithNoGoodGesture,
FaceWithOkGesture,
PersonBowingDeeply,
SeeDashNoDashEvilMonkey,
HearDashNoDashEvilMonkey,
SpeakDashNoDashEvilMonkey,
HappyPersonRaisingOneHand,
PersonRaisingBothHandsInCelebration,
PersonFrowning,
PersonWithPoutingFace,
}
impl Into<char> for Emoticons {
fn into(self) -> char {
match self {
Emoticons::GrinningFace => '😀',
Emoticons::GrinningFaceWithSmilingEyes => '😁',
Emoticons::FaceWithTearsOfJoy => '😂',
Emoticons::SmilingFaceWithOpenMouth => '😃',
Emoticons::SmilingFaceWithOpenMouthAndSmilingEyes => '😄',
Emoticons::SmilingFaceWithOpenMouthAndColdSweat => '😅',
Emoticons::SmilingFaceWithOpenMouthAndTightlyDashClosedEyes => '😆',
Emoticons::SmilingFaceWithHalo => '😇',
Emoticons::SmilingFaceWithHorns => '😈',
Emoticons::WinkingFace => '😉',
Emoticons::SmilingFaceWithSmilingEyes => '😊',
Emoticons::FaceSavouringDeliciousFood => '😋',
Emoticons::RelievedFace => '😌',
Emoticons::SmilingFaceWithHeartDashShapedEyes => '😍',
Emoticons::SmilingFaceWithSunglasses => '😎',
Emoticons::SmirkingFace => '😏',
Emoticons::NeutralFace => '😐',
Emoticons::ExpressionlessFace => '😑',
Emoticons::UnamusedFace => '😒',
Emoticons::FaceWithColdSweat => '😓',
Emoticons::PensiveFace => '😔',
Emoticons::ConfusedFace => '😕',
Emoticons::ConfoundedFace => '😖',
Emoticons::KissingFace => '😗',
Emoticons::FaceThrowingAKiss => '😘',
Emoticons::KissingFaceWithSmilingEyes => '😙',
Emoticons::KissingFaceWithClosedEyes => '😚',
Emoticons::FaceWithStuckDashOutTongue => '😛',
Emoticons::FaceWithStuckDashOutTongueAndWinkingEye => '😜',
Emoticons::FaceWithStuckDashOutTongueAndTightlyDashClosedEyes => '😝',
Emoticons::DisappointedFace => '😞',
Emoticons::WorriedFace => '😟',
Emoticons::AngryFace => '😠',
Emoticons::PoutingFace => '😡',
Emoticons::CryingFace => '😢',
Emoticons::PerseveringFace => '😣',
Emoticons::FaceWithLookOfTriumph => '😤',
Emoticons::DisappointedButRelievedFace => '😥',
Emoticons::FrowningFaceWithOpenMouth => '😦',
Emoticons::AnguishedFace => '😧',
Emoticons::FearfulFace => '😨',
Emoticons::WearyFace => '😩',
Emoticons::SleepyFace => '😪',
Emoticons::TiredFace => '😫',
Emoticons::GrimacingFace => '😬',
Emoticons::LoudlyCryingFace => '😭',
Emoticons::FaceWithOpenMouth => '😮',
Emoticons::HushedFace => '😯',
Emoticons::FaceWithOpenMouthAndColdSweat => '😰',
Emoticons::FaceScreamingInFear => '😱',
Emoticons::AstonishedFace => '😲',
Emoticons::FlushedFace => '😳',
Emoticons::SleepingFace => '😴',
Emoticons::DizzyFace => '😵',
Emoticons::FaceWithoutMouth => '😶',
Emoticons::FaceWithMedicalMask => '😷',
Emoticons::GrinningCatFaceWithSmilingEyes => '😸',
Emoticons::CatFaceWithTearsOfJoy => '😹',
Emoticons::SmilingCatFaceWithOpenMouth => '😺',
Emoticons::SmilingCatFaceWithHeartDashShapedEyes => '😻',
Emoticons::CatFaceWithWrySmile => '😼',
Emoticons::KissingCatFaceWithClosedEyes => '😽',
Emoticons::PoutingCatFace => '😾',
Emoticons::CryingCatFace => '😿',
Emoticons::WearyCatFace => '🙀',
Emoticons::SlightlyFrowningFace => '🙁',
Emoticons::SlightlySmilingFace => '🙂',
Emoticons::UpsideDashDownFace => '🙃',
Emoticons::FaceWithRollingEyes => '🙄',
Emoticons::FaceWithNoGoodGesture => '🙅',
Emoticons::FaceWithOkGesture => '🙆',
Emoticons::PersonBowingDeeply => '🙇',
Emoticons::SeeDashNoDashEvilMonkey => '🙈',
Emoticons::HearDashNoDashEvilMonkey => '🙉',
Emoticons::SpeakDashNoDashEvilMonkey => '🙊',
Emoticons::HappyPersonRaisingOneHand => '🙋',
Emoticons::PersonRaisingBothHandsInCelebration => '🙌',
Emoticons::PersonFrowning => '🙍',
Emoticons::PersonWithPoutingFace => '🙎',
}
}
}
impl std::convert::TryFrom<char> for Emoticons {
type Error = ();
fn try_from(c: char) -> Result<Self, Self::Error> {
match c {
'😀' => Ok(Emoticons::GrinningFace),
'😁' => Ok(Emoticons::GrinningFaceWithSmilingEyes),
'😂' => Ok(Emoticons::FaceWithTearsOfJoy),
'😃' => Ok(Emoticons::SmilingFaceWithOpenMouth),
'😄' => Ok(Emoticons::SmilingFaceWithOpenMouthAndSmilingEyes),
'😅' => Ok(Emoticons::SmilingFaceWithOpenMouthAndColdSweat),
'😆' => Ok(Emoticons::SmilingFaceWithOpenMouthAndTightlyDashClosedEyes),
'😇' => Ok(Emoticons::SmilingFaceWithHalo),
'😈' => Ok(Emoticons::SmilingFaceWithHorns),
'😉' => Ok(Emoticons::WinkingFace),
'😊' => Ok(Emoticons::SmilingFaceWithSmilingEyes),
'😋' => Ok(Emoticons::FaceSavouringDeliciousFood),
'😌' => Ok(Emoticons::RelievedFace),
'😍' => Ok(Emoticons::SmilingFaceWithHeartDashShapedEyes),
'😎' => Ok(Emoticons::SmilingFaceWithSunglasses),
'😏' => Ok(Emoticons::SmirkingFace),
'😐' => Ok(Emoticons::NeutralFace),
'😑' => Ok(Emoticons::ExpressionlessFace),
'😒' => Ok(Emoticons::UnamusedFace),
'😓' => Ok(Emoticons::FaceWithColdSweat),
'😔' => Ok(Emoticons::PensiveFace),
'😕' => Ok(Emoticons::ConfusedFace),
'😖' => Ok(Emoticons::ConfoundedFace),
'😗' => Ok(Emoticons::KissingFace),
'😘' => Ok(Emoticons::FaceThrowingAKiss),
'😙' => Ok(Emoticons::KissingFaceWithSmilingEyes),
'😚' => Ok(Emoticons::KissingFaceWithClosedEyes),
'😛' => Ok(Emoticons::FaceWithStuckDashOutTongue),
'😜' => Ok(Emoticons::FaceWithStuckDashOutTongueAndWinkingEye),
'😝' => Ok(Emoticons::FaceWithStuckDashOutTongueAndTightlyDashClosedEyes),
'😞' => Ok(Emoticons::DisappointedFace),
'😟' => Ok(Emoticons::WorriedFace),
'😠' => Ok(Emoticons::AngryFace),
'😡' => Ok(Emoticons::PoutingFace),
'😢' => Ok(Emoticons::CryingFace),
'😣' => Ok(Emoticons::PerseveringFace),
'😤' => Ok(Emoticons::FaceWithLookOfTriumph),
'😥' => Ok(Emoticons::DisappointedButRelievedFace),
'😦' => Ok(Emoticons::FrowningFaceWithOpenMouth),
'😧' => Ok(Emoticons::AnguishedFace),
'😨' => Ok(Emoticons::FearfulFace),
'😩' => Ok(Emoticons::WearyFace),
'😪' => Ok(Emoticons::SleepyFace),
'😫' => Ok(Emoticons::TiredFace),
'😬' => Ok(Emoticons::GrimacingFace),
'😭' => Ok(Emoticons::LoudlyCryingFace),
'😮' => Ok(Emoticons::FaceWithOpenMouth),
'😯' => Ok(Emoticons::HushedFace),
'😰' => Ok(Emoticons::FaceWithOpenMouthAndColdSweat),
'😱' => Ok(Emoticons::FaceScreamingInFear),
'😲' => Ok(Emoticons::AstonishedFace),
'😳' => Ok(Emoticons::FlushedFace),
'😴' => Ok(Emoticons::SleepingFace),
'😵' => Ok(Emoticons::DizzyFace),
'😶' => Ok(Emoticons::FaceWithoutMouth),
'😷' => Ok(Emoticons::FaceWithMedicalMask),
'😸' => Ok(Emoticons::GrinningCatFaceWithSmilingEyes),
'😹' => Ok(Emoticons::CatFaceWithTearsOfJoy),
'😺' => Ok(Emoticons::SmilingCatFaceWithOpenMouth),
'😻' => Ok(Emoticons::SmilingCatFaceWithHeartDashShapedEyes),
'😼' => Ok(Emoticons::CatFaceWithWrySmile),
'😽' => Ok(Emoticons::KissingCatFaceWithClosedEyes),
'😾' => Ok(Emoticons::PoutingCatFace),
'😿' => Ok(Emoticons::CryingCatFace),
'🙀' => Ok(Emoticons::WearyCatFace),
'🙁' => Ok(Emoticons::SlightlyFrowningFace),
'🙂' => Ok(Emoticons::SlightlySmilingFace),
'🙃' => Ok(Emoticons::UpsideDashDownFace),
'🙄' => Ok(Emoticons::FaceWithRollingEyes),
'🙅' => Ok(Emoticons::FaceWithNoGoodGesture),
'🙆' => Ok(Emoticons::FaceWithOkGesture),
'🙇' => Ok(Emoticons::PersonBowingDeeply),
'🙈' => Ok(Emoticons::SeeDashNoDashEvilMonkey),
'🙉' => Ok(Emoticons::HearDashNoDashEvilMonkey),
'🙊' => Ok(Emoticons::SpeakDashNoDashEvilMonkey),
'🙋' => Ok(Emoticons::HappyPersonRaisingOneHand),
'🙌' => Ok(Emoticons::PersonRaisingBothHandsInCelebration),
'🙍' => Ok(Emoticons::PersonFrowning),
'🙎' => Ok(Emoticons::PersonWithPoutingFace),
_ => Err(()),
}
}
}
impl Into<u32> for Emoticons {
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 Emoticons {
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 Emoticons {
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 Emoticons {
pub fn new() -> Self {
Emoticons::GrinningFace
}
pub fn name(&self) -> String {
let s = std::format!("Emoticons{:#?}", self);
string_morph::to_sentence_case(&s)
}
}