mod constants {
pub const PLAYING_CARD_BACK: char = '🂠';
pub const PLAYING_CARD_ACE_OF_SPADES: char = '🂡';
pub const PLAYING_CARD_TWO_OF_SPADES: char = '🂢';
pub const PLAYING_CARD_THREE_OF_SPADES: char = '🂣';
pub const PLAYING_CARD_FOUR_OF_SPADES: char = '🂤';
pub const PLAYING_CARD_FIVE_OF_SPADES: char = '🂥';
pub const PLAYING_CARD_SIX_OF_SPADES: char = '🂦';
pub const PLAYING_CARD_SEVEN_OF_SPADES: char = '🂧';
pub const PLAYING_CARD_EIGHT_OF_SPADES: char = '🂨';
pub const PLAYING_CARD_NINE_OF_SPADES: char = '🂩';
pub const PLAYING_CARD_TEN_OF_SPADES: char = '🂪';
pub const PLAYING_CARD_JACK_OF_SPADES: char = '🂫';
pub const PLAYING_CARD_KNIGHT_OF_SPADES: char = '🂬';
pub const PLAYING_CARD_QUEEN_OF_SPADES: char = '🂭';
pub const PLAYING_CARD_KING_OF_SPADES: char = '🂮';
pub const PLAYING_CARD_ACE_OF_HEARTS: char = '🂱';
pub const PLAYING_CARD_TWO_OF_HEARTS: char = '🂲';
pub const PLAYING_CARD_THREE_OF_HEARTS: char = '🂳';
pub const PLAYING_CARD_FOUR_OF_HEARTS: char = '🂴';
pub const PLAYING_CARD_FIVE_OF_HEARTS: char = '🂵';
pub const PLAYING_CARD_SIX_OF_HEARTS: char = '🂶';
pub const PLAYING_CARD_SEVEN_OF_HEARTS: char = '🂷';
pub const PLAYING_CARD_EIGHT_OF_HEARTS: char = '🂸';
pub const PLAYING_CARD_NINE_OF_HEARTS: char = '🂹';
pub const PLAYING_CARD_TEN_OF_HEARTS: char = '🂺';
pub const PLAYING_CARD_JACK_OF_HEARTS: char = '🂻';
pub const PLAYING_CARD_KNIGHT_OF_HEARTS: char = '🂼';
pub const PLAYING_CARD_QUEEN_OF_HEARTS: char = '🂽';
pub const PLAYING_CARD_KING_OF_HEARTS: char = '🂾';
pub const PLAYING_CARD_RED_JOKER: char = '🂿';
pub const PLAYING_CARD_ACE_OF_DIAMONDS: char = '🃁';
pub const PLAYING_CARD_TWO_OF_DIAMONDS: char = '🃂';
pub const PLAYING_CARD_THREE_OF_DIAMONDS: char = '🃃';
pub const PLAYING_CARD_FOUR_OF_DIAMONDS: char = '🃄';
pub const PLAYING_CARD_FIVE_OF_DIAMONDS: char = '🃅';
pub const PLAYING_CARD_SIX_OF_DIAMONDS: char = '🃆';
pub const PLAYING_CARD_SEVEN_OF_DIAMONDS: char = '🃇';
pub const PLAYING_CARD_EIGHT_OF_DIAMONDS: char = '🃈';
pub const PLAYING_CARD_NINE_OF_DIAMONDS: char = '🃉';
pub const PLAYING_CARD_TEN_OF_DIAMONDS: char = '🃊';
pub const PLAYING_CARD_JACK_OF_DIAMONDS: char = '🃋';
pub const PLAYING_CARD_KNIGHT_OF_DIAMONDS: char = '🃌';
pub const PLAYING_CARD_QUEEN_OF_DIAMONDS: char = '🃍';
pub const PLAYING_CARD_KING_OF_DIAMONDS: char = '🃎';
pub const PLAYING_CARD_BLACK_JOKER: char = '🃏';
pub const PLAYING_CARD_ACE_OF_CLUBS: char = '🃑';
pub const PLAYING_CARD_TWO_OF_CLUBS: char = '🃒';
pub const PLAYING_CARD_THREE_OF_CLUBS: char = '🃓';
pub const PLAYING_CARD_FOUR_OF_CLUBS: char = '🃔';
pub const PLAYING_CARD_FIVE_OF_CLUBS: char = '🃕';
pub const PLAYING_CARD_SIX_OF_CLUBS: char = '🃖';
pub const PLAYING_CARD_SEVEN_OF_CLUBS: char = '🃗';
pub const PLAYING_CARD_EIGHT_OF_CLUBS: char = '🃘';
pub const PLAYING_CARD_NINE_OF_CLUBS: char = '🃙';
pub const PLAYING_CARD_TEN_OF_CLUBS: char = '🃚';
pub const PLAYING_CARD_JACK_OF_CLUBS: char = '🃛';
pub const PLAYING_CARD_KNIGHT_OF_CLUBS: char = '🃜';
pub const PLAYING_CARD_QUEEN_OF_CLUBS: char = '🃝';
pub const PLAYING_CARD_KING_OF_CLUBS: char = '🃞';
pub const PLAYING_CARD_WHITE_JOKER: char = '🃟';
pub const PLAYING_CARD_FOOL: char = '🃠';
pub const PLAYING_CARD_TRUMP_DASH_1: char = '🃡';
pub const PLAYING_CARD_TRUMP_DASH_2: char = '🃢';
pub const PLAYING_CARD_TRUMP_DASH_3: char = '🃣';
pub const PLAYING_CARD_TRUMP_DASH_4: char = '🃤';
pub const PLAYING_CARD_TRUMP_DASH_5: char = '🃥';
pub const PLAYING_CARD_TRUMP_DASH_6: char = '🃦';
pub const PLAYING_CARD_TRUMP_DASH_7: char = '🃧';
pub const PLAYING_CARD_TRUMP_DASH_8: char = '🃨';
pub const PLAYING_CARD_TRUMP_DASH_9: char = '🃩';
pub const PLAYING_CARD_TRUMP_DASH_10: char = '🃪';
pub const PLAYING_CARD_TRUMP_DASH_11: char = '🃫';
pub const PLAYING_CARD_TRUMP_DASH_12: char = '🃬';
pub const PLAYING_CARD_TRUMP_DASH_13: char = '🃭';
pub const PLAYING_CARD_TRUMP_DASH_14: char = '🃮';
pub const PLAYING_CARD_TRUMP_DASH_15: char = '🃯';
pub const PLAYING_CARD_TRUMP_DASH_16: char = '🃰';
pub const PLAYING_CARD_TRUMP_DASH_17: char = '🃱';
pub const PLAYING_CARD_TRUMP_DASH_18: char = '🃲';
pub const PLAYING_CARD_TRUMP_DASH_19: char = '🃳';
pub const PLAYING_CARD_TRUMP_DASH_20: char = '🃴';
pub const PLAYING_CARD_TRUMP_DASH_21: char = '🃵';
}
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum PlayingCards {
PlayingCardBack,
PlayingCardAceOfSpades,
PlayingCardTwoOfSpades,
PlayingCardThreeOfSpades,
PlayingCardFourOfSpades,
PlayingCardFiveOfSpades,
PlayingCardSixOfSpades,
PlayingCardSevenOfSpades,
PlayingCardEightOfSpades,
PlayingCardNineOfSpades,
PlayingCardTenOfSpades,
PlayingCardJackOfSpades,
PlayingCardKnightOfSpades,
PlayingCardQueenOfSpades,
PlayingCardKingOfSpades,
PlayingCardAceOfHearts,
PlayingCardTwoOfHearts,
PlayingCardThreeOfHearts,
PlayingCardFourOfHearts,
PlayingCardFiveOfHearts,
PlayingCardSixOfHearts,
PlayingCardSevenOfHearts,
PlayingCardEightOfHearts,
PlayingCardNineOfHearts,
PlayingCardTenOfHearts,
PlayingCardJackOfHearts,
PlayingCardKnightOfHearts,
PlayingCardQueenOfHearts,
PlayingCardKingOfHearts,
PlayingCardRedJoker,
PlayingCardAceOfDiamonds,
PlayingCardTwoOfDiamonds,
PlayingCardThreeOfDiamonds,
PlayingCardFourOfDiamonds,
PlayingCardFiveOfDiamonds,
PlayingCardSixOfDiamonds,
PlayingCardSevenOfDiamonds,
PlayingCardEightOfDiamonds,
PlayingCardNineOfDiamonds,
PlayingCardTenOfDiamonds,
PlayingCardJackOfDiamonds,
PlayingCardKnightOfDiamonds,
PlayingCardQueenOfDiamonds,
PlayingCardKingOfDiamonds,
PlayingCardBlackJoker,
PlayingCardAceOfClubs,
PlayingCardTwoOfClubs,
PlayingCardThreeOfClubs,
PlayingCardFourOfClubs,
PlayingCardFiveOfClubs,
PlayingCardSixOfClubs,
PlayingCardSevenOfClubs,
PlayingCardEightOfClubs,
PlayingCardNineOfClubs,
PlayingCardTenOfClubs,
PlayingCardJackOfClubs,
PlayingCardKnightOfClubs,
PlayingCardQueenOfClubs,
PlayingCardKingOfClubs,
PlayingCardWhiteJoker,
PlayingCardFool,
PlayingCardTrumpDash1,
PlayingCardTrumpDash2,
PlayingCardTrumpDash3,
PlayingCardTrumpDash4,
PlayingCardTrumpDash5,
PlayingCardTrumpDash6,
PlayingCardTrumpDash7,
PlayingCardTrumpDash8,
PlayingCardTrumpDash9,
PlayingCardTrumpDash10,
PlayingCardTrumpDash11,
PlayingCardTrumpDash12,
PlayingCardTrumpDash13,
PlayingCardTrumpDash14,
PlayingCardTrumpDash15,
PlayingCardTrumpDash16,
PlayingCardTrumpDash17,
PlayingCardTrumpDash18,
PlayingCardTrumpDash19,
PlayingCardTrumpDash20,
PlayingCardTrumpDash21,
}
impl Into<char> for PlayingCards {
fn into(self) -> char {
use constants::*;
match self {
PlayingCards::PlayingCardBack => PLAYING_CARD_BACK,
PlayingCards::PlayingCardAceOfSpades => PLAYING_CARD_ACE_OF_SPADES,
PlayingCards::PlayingCardTwoOfSpades => PLAYING_CARD_TWO_OF_SPADES,
PlayingCards::PlayingCardThreeOfSpades => PLAYING_CARD_THREE_OF_SPADES,
PlayingCards::PlayingCardFourOfSpades => PLAYING_CARD_FOUR_OF_SPADES,
PlayingCards::PlayingCardFiveOfSpades => PLAYING_CARD_FIVE_OF_SPADES,
PlayingCards::PlayingCardSixOfSpades => PLAYING_CARD_SIX_OF_SPADES,
PlayingCards::PlayingCardSevenOfSpades => PLAYING_CARD_SEVEN_OF_SPADES,
PlayingCards::PlayingCardEightOfSpades => PLAYING_CARD_EIGHT_OF_SPADES,
PlayingCards::PlayingCardNineOfSpades => PLAYING_CARD_NINE_OF_SPADES,
PlayingCards::PlayingCardTenOfSpades => PLAYING_CARD_TEN_OF_SPADES,
PlayingCards::PlayingCardJackOfSpades => PLAYING_CARD_JACK_OF_SPADES,
PlayingCards::PlayingCardKnightOfSpades => PLAYING_CARD_KNIGHT_OF_SPADES,
PlayingCards::PlayingCardQueenOfSpades => PLAYING_CARD_QUEEN_OF_SPADES,
PlayingCards::PlayingCardKingOfSpades => PLAYING_CARD_KING_OF_SPADES,
PlayingCards::PlayingCardAceOfHearts => PLAYING_CARD_ACE_OF_HEARTS,
PlayingCards::PlayingCardTwoOfHearts => PLAYING_CARD_TWO_OF_HEARTS,
PlayingCards::PlayingCardThreeOfHearts => PLAYING_CARD_THREE_OF_HEARTS,
PlayingCards::PlayingCardFourOfHearts => PLAYING_CARD_FOUR_OF_HEARTS,
PlayingCards::PlayingCardFiveOfHearts => PLAYING_CARD_FIVE_OF_HEARTS,
PlayingCards::PlayingCardSixOfHearts => PLAYING_CARD_SIX_OF_HEARTS,
PlayingCards::PlayingCardSevenOfHearts => PLAYING_CARD_SEVEN_OF_HEARTS,
PlayingCards::PlayingCardEightOfHearts => PLAYING_CARD_EIGHT_OF_HEARTS,
PlayingCards::PlayingCardNineOfHearts => PLAYING_CARD_NINE_OF_HEARTS,
PlayingCards::PlayingCardTenOfHearts => PLAYING_CARD_TEN_OF_HEARTS,
PlayingCards::PlayingCardJackOfHearts => PLAYING_CARD_JACK_OF_HEARTS,
PlayingCards::PlayingCardKnightOfHearts => PLAYING_CARD_KNIGHT_OF_HEARTS,
PlayingCards::PlayingCardQueenOfHearts => PLAYING_CARD_QUEEN_OF_HEARTS,
PlayingCards::PlayingCardKingOfHearts => PLAYING_CARD_KING_OF_HEARTS,
PlayingCards::PlayingCardRedJoker => PLAYING_CARD_RED_JOKER,
PlayingCards::PlayingCardAceOfDiamonds => PLAYING_CARD_ACE_OF_DIAMONDS,
PlayingCards::PlayingCardTwoOfDiamonds => PLAYING_CARD_TWO_OF_DIAMONDS,
PlayingCards::PlayingCardThreeOfDiamonds => PLAYING_CARD_THREE_OF_DIAMONDS,
PlayingCards::PlayingCardFourOfDiamonds => PLAYING_CARD_FOUR_OF_DIAMONDS,
PlayingCards::PlayingCardFiveOfDiamonds => PLAYING_CARD_FIVE_OF_DIAMONDS,
PlayingCards::PlayingCardSixOfDiamonds => PLAYING_CARD_SIX_OF_DIAMONDS,
PlayingCards::PlayingCardSevenOfDiamonds => PLAYING_CARD_SEVEN_OF_DIAMONDS,
PlayingCards::PlayingCardEightOfDiamonds => PLAYING_CARD_EIGHT_OF_DIAMONDS,
PlayingCards::PlayingCardNineOfDiamonds => PLAYING_CARD_NINE_OF_DIAMONDS,
PlayingCards::PlayingCardTenOfDiamonds => PLAYING_CARD_TEN_OF_DIAMONDS,
PlayingCards::PlayingCardJackOfDiamonds => PLAYING_CARD_JACK_OF_DIAMONDS,
PlayingCards::PlayingCardKnightOfDiamonds => PLAYING_CARD_KNIGHT_OF_DIAMONDS,
PlayingCards::PlayingCardQueenOfDiamonds => PLAYING_CARD_QUEEN_OF_DIAMONDS,
PlayingCards::PlayingCardKingOfDiamonds => PLAYING_CARD_KING_OF_DIAMONDS,
PlayingCards::PlayingCardBlackJoker => PLAYING_CARD_BLACK_JOKER,
PlayingCards::PlayingCardAceOfClubs => PLAYING_CARD_ACE_OF_CLUBS,
PlayingCards::PlayingCardTwoOfClubs => PLAYING_CARD_TWO_OF_CLUBS,
PlayingCards::PlayingCardThreeOfClubs => PLAYING_CARD_THREE_OF_CLUBS,
PlayingCards::PlayingCardFourOfClubs => PLAYING_CARD_FOUR_OF_CLUBS,
PlayingCards::PlayingCardFiveOfClubs => PLAYING_CARD_FIVE_OF_CLUBS,
PlayingCards::PlayingCardSixOfClubs => PLAYING_CARD_SIX_OF_CLUBS,
PlayingCards::PlayingCardSevenOfClubs => PLAYING_CARD_SEVEN_OF_CLUBS,
PlayingCards::PlayingCardEightOfClubs => PLAYING_CARD_EIGHT_OF_CLUBS,
PlayingCards::PlayingCardNineOfClubs => PLAYING_CARD_NINE_OF_CLUBS,
PlayingCards::PlayingCardTenOfClubs => PLAYING_CARD_TEN_OF_CLUBS,
PlayingCards::PlayingCardJackOfClubs => PLAYING_CARD_JACK_OF_CLUBS,
PlayingCards::PlayingCardKnightOfClubs => PLAYING_CARD_KNIGHT_OF_CLUBS,
PlayingCards::PlayingCardQueenOfClubs => PLAYING_CARD_QUEEN_OF_CLUBS,
PlayingCards::PlayingCardKingOfClubs => PLAYING_CARD_KING_OF_CLUBS,
PlayingCards::PlayingCardWhiteJoker => PLAYING_CARD_WHITE_JOKER,
PlayingCards::PlayingCardFool => PLAYING_CARD_FOOL,
PlayingCards::PlayingCardTrumpDash1 => PLAYING_CARD_TRUMP_DASH_1,
PlayingCards::PlayingCardTrumpDash2 => PLAYING_CARD_TRUMP_DASH_2,
PlayingCards::PlayingCardTrumpDash3 => PLAYING_CARD_TRUMP_DASH_3,
PlayingCards::PlayingCardTrumpDash4 => PLAYING_CARD_TRUMP_DASH_4,
PlayingCards::PlayingCardTrumpDash5 => PLAYING_CARD_TRUMP_DASH_5,
PlayingCards::PlayingCardTrumpDash6 => PLAYING_CARD_TRUMP_DASH_6,
PlayingCards::PlayingCardTrumpDash7 => PLAYING_CARD_TRUMP_DASH_7,
PlayingCards::PlayingCardTrumpDash8 => PLAYING_CARD_TRUMP_DASH_8,
PlayingCards::PlayingCardTrumpDash9 => PLAYING_CARD_TRUMP_DASH_9,
PlayingCards::PlayingCardTrumpDash10 => PLAYING_CARD_TRUMP_DASH_10,
PlayingCards::PlayingCardTrumpDash11 => PLAYING_CARD_TRUMP_DASH_11,
PlayingCards::PlayingCardTrumpDash12 => PLAYING_CARD_TRUMP_DASH_12,
PlayingCards::PlayingCardTrumpDash13 => PLAYING_CARD_TRUMP_DASH_13,
PlayingCards::PlayingCardTrumpDash14 => PLAYING_CARD_TRUMP_DASH_14,
PlayingCards::PlayingCardTrumpDash15 => PLAYING_CARD_TRUMP_DASH_15,
PlayingCards::PlayingCardTrumpDash16 => PLAYING_CARD_TRUMP_DASH_16,
PlayingCards::PlayingCardTrumpDash17 => PLAYING_CARD_TRUMP_DASH_17,
PlayingCards::PlayingCardTrumpDash18 => PLAYING_CARD_TRUMP_DASH_18,
PlayingCards::PlayingCardTrumpDash19 => PLAYING_CARD_TRUMP_DASH_19,
PlayingCards::PlayingCardTrumpDash20 => PLAYING_CARD_TRUMP_DASH_20,
PlayingCards::PlayingCardTrumpDash21 => PLAYING_CARD_TRUMP_DASH_21,
}
}
}
impl std::convert::TryFrom<char> for PlayingCards {
type Error = ();
fn try_from(c: char) -> Result<Self, Self::Error> {
use constants::*;
match c {
PLAYING_CARD_BACK => Ok(PlayingCards::PlayingCardBack),
PLAYING_CARD_ACE_OF_SPADES => Ok(PlayingCards::PlayingCardAceOfSpades),
PLAYING_CARD_TWO_OF_SPADES => Ok(PlayingCards::PlayingCardTwoOfSpades),
PLAYING_CARD_THREE_OF_SPADES => Ok(PlayingCards::PlayingCardThreeOfSpades),
PLAYING_CARD_FOUR_OF_SPADES => Ok(PlayingCards::PlayingCardFourOfSpades),
PLAYING_CARD_FIVE_OF_SPADES => Ok(PlayingCards::PlayingCardFiveOfSpades),
PLAYING_CARD_SIX_OF_SPADES => Ok(PlayingCards::PlayingCardSixOfSpades),
PLAYING_CARD_SEVEN_OF_SPADES => Ok(PlayingCards::PlayingCardSevenOfSpades),
PLAYING_CARD_EIGHT_OF_SPADES => Ok(PlayingCards::PlayingCardEightOfSpades),
PLAYING_CARD_NINE_OF_SPADES => Ok(PlayingCards::PlayingCardNineOfSpades),
PLAYING_CARD_TEN_OF_SPADES => Ok(PlayingCards::PlayingCardTenOfSpades),
PLAYING_CARD_JACK_OF_SPADES => Ok(PlayingCards::PlayingCardJackOfSpades),
PLAYING_CARD_KNIGHT_OF_SPADES => Ok(PlayingCards::PlayingCardKnightOfSpades),
PLAYING_CARD_QUEEN_OF_SPADES => Ok(PlayingCards::PlayingCardQueenOfSpades),
PLAYING_CARD_KING_OF_SPADES => Ok(PlayingCards::PlayingCardKingOfSpades),
PLAYING_CARD_ACE_OF_HEARTS => Ok(PlayingCards::PlayingCardAceOfHearts),
PLAYING_CARD_TWO_OF_HEARTS => Ok(PlayingCards::PlayingCardTwoOfHearts),
PLAYING_CARD_THREE_OF_HEARTS => Ok(PlayingCards::PlayingCardThreeOfHearts),
PLAYING_CARD_FOUR_OF_HEARTS => Ok(PlayingCards::PlayingCardFourOfHearts),
PLAYING_CARD_FIVE_OF_HEARTS => Ok(PlayingCards::PlayingCardFiveOfHearts),
PLAYING_CARD_SIX_OF_HEARTS => Ok(PlayingCards::PlayingCardSixOfHearts),
PLAYING_CARD_SEVEN_OF_HEARTS => Ok(PlayingCards::PlayingCardSevenOfHearts),
PLAYING_CARD_EIGHT_OF_HEARTS => Ok(PlayingCards::PlayingCardEightOfHearts),
PLAYING_CARD_NINE_OF_HEARTS => Ok(PlayingCards::PlayingCardNineOfHearts),
PLAYING_CARD_TEN_OF_HEARTS => Ok(PlayingCards::PlayingCardTenOfHearts),
PLAYING_CARD_JACK_OF_HEARTS => Ok(PlayingCards::PlayingCardJackOfHearts),
PLAYING_CARD_KNIGHT_OF_HEARTS => Ok(PlayingCards::PlayingCardKnightOfHearts),
PLAYING_CARD_QUEEN_OF_HEARTS => Ok(PlayingCards::PlayingCardQueenOfHearts),
PLAYING_CARD_KING_OF_HEARTS => Ok(PlayingCards::PlayingCardKingOfHearts),
PLAYING_CARD_RED_JOKER => Ok(PlayingCards::PlayingCardRedJoker),
PLAYING_CARD_ACE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardAceOfDiamonds),
PLAYING_CARD_TWO_OF_DIAMONDS => Ok(PlayingCards::PlayingCardTwoOfDiamonds),
PLAYING_CARD_THREE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardThreeOfDiamonds),
PLAYING_CARD_FOUR_OF_DIAMONDS => Ok(PlayingCards::PlayingCardFourOfDiamonds),
PLAYING_CARD_FIVE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardFiveOfDiamonds),
PLAYING_CARD_SIX_OF_DIAMONDS => Ok(PlayingCards::PlayingCardSixOfDiamonds),
PLAYING_CARD_SEVEN_OF_DIAMONDS => Ok(PlayingCards::PlayingCardSevenOfDiamonds),
PLAYING_CARD_EIGHT_OF_DIAMONDS => Ok(PlayingCards::PlayingCardEightOfDiamonds),
PLAYING_CARD_NINE_OF_DIAMONDS => Ok(PlayingCards::PlayingCardNineOfDiamonds),
PLAYING_CARD_TEN_OF_DIAMONDS => Ok(PlayingCards::PlayingCardTenOfDiamonds),
PLAYING_CARD_JACK_OF_DIAMONDS => Ok(PlayingCards::PlayingCardJackOfDiamonds),
PLAYING_CARD_KNIGHT_OF_DIAMONDS => Ok(PlayingCards::PlayingCardKnightOfDiamonds),
PLAYING_CARD_QUEEN_OF_DIAMONDS => Ok(PlayingCards::PlayingCardQueenOfDiamonds),
PLAYING_CARD_KING_OF_DIAMONDS => Ok(PlayingCards::PlayingCardKingOfDiamonds),
PLAYING_CARD_BLACK_JOKER => Ok(PlayingCards::PlayingCardBlackJoker),
PLAYING_CARD_ACE_OF_CLUBS => Ok(PlayingCards::PlayingCardAceOfClubs),
PLAYING_CARD_TWO_OF_CLUBS => Ok(PlayingCards::PlayingCardTwoOfClubs),
PLAYING_CARD_THREE_OF_CLUBS => Ok(PlayingCards::PlayingCardThreeOfClubs),
PLAYING_CARD_FOUR_OF_CLUBS => Ok(PlayingCards::PlayingCardFourOfClubs),
PLAYING_CARD_FIVE_OF_CLUBS => Ok(PlayingCards::PlayingCardFiveOfClubs),
PLAYING_CARD_SIX_OF_CLUBS => Ok(PlayingCards::PlayingCardSixOfClubs),
PLAYING_CARD_SEVEN_OF_CLUBS => Ok(PlayingCards::PlayingCardSevenOfClubs),
PLAYING_CARD_EIGHT_OF_CLUBS => Ok(PlayingCards::PlayingCardEightOfClubs),
PLAYING_CARD_NINE_OF_CLUBS => Ok(PlayingCards::PlayingCardNineOfClubs),
PLAYING_CARD_TEN_OF_CLUBS => Ok(PlayingCards::PlayingCardTenOfClubs),
PLAYING_CARD_JACK_OF_CLUBS => Ok(PlayingCards::PlayingCardJackOfClubs),
PLAYING_CARD_KNIGHT_OF_CLUBS => Ok(PlayingCards::PlayingCardKnightOfClubs),
PLAYING_CARD_QUEEN_OF_CLUBS => Ok(PlayingCards::PlayingCardQueenOfClubs),
PLAYING_CARD_KING_OF_CLUBS => Ok(PlayingCards::PlayingCardKingOfClubs),
PLAYING_CARD_WHITE_JOKER => Ok(PlayingCards::PlayingCardWhiteJoker),
PLAYING_CARD_FOOL => Ok(PlayingCards::PlayingCardFool),
PLAYING_CARD_TRUMP_DASH_1 => Ok(PlayingCards::PlayingCardTrumpDash1),
PLAYING_CARD_TRUMP_DASH_2 => Ok(PlayingCards::PlayingCardTrumpDash2),
PLAYING_CARD_TRUMP_DASH_3 => Ok(PlayingCards::PlayingCardTrumpDash3),
PLAYING_CARD_TRUMP_DASH_4 => Ok(PlayingCards::PlayingCardTrumpDash4),
PLAYING_CARD_TRUMP_DASH_5 => Ok(PlayingCards::PlayingCardTrumpDash5),
PLAYING_CARD_TRUMP_DASH_6 => Ok(PlayingCards::PlayingCardTrumpDash6),
PLAYING_CARD_TRUMP_DASH_7 => Ok(PlayingCards::PlayingCardTrumpDash7),
PLAYING_CARD_TRUMP_DASH_8 => Ok(PlayingCards::PlayingCardTrumpDash8),
PLAYING_CARD_TRUMP_DASH_9 => Ok(PlayingCards::PlayingCardTrumpDash9),
PLAYING_CARD_TRUMP_DASH_10 => Ok(PlayingCards::PlayingCardTrumpDash10),
PLAYING_CARD_TRUMP_DASH_11 => Ok(PlayingCards::PlayingCardTrumpDash11),
PLAYING_CARD_TRUMP_DASH_12 => Ok(PlayingCards::PlayingCardTrumpDash12),
PLAYING_CARD_TRUMP_DASH_13 => Ok(PlayingCards::PlayingCardTrumpDash13),
PLAYING_CARD_TRUMP_DASH_14 => Ok(PlayingCards::PlayingCardTrumpDash14),
PLAYING_CARD_TRUMP_DASH_15 => Ok(PlayingCards::PlayingCardTrumpDash15),
PLAYING_CARD_TRUMP_DASH_16 => Ok(PlayingCards::PlayingCardTrumpDash16),
PLAYING_CARD_TRUMP_DASH_17 => Ok(PlayingCards::PlayingCardTrumpDash17),
PLAYING_CARD_TRUMP_DASH_18 => Ok(PlayingCards::PlayingCardTrumpDash18),
PLAYING_CARD_TRUMP_DASH_19 => Ok(PlayingCards::PlayingCardTrumpDash19),
PLAYING_CARD_TRUMP_DASH_20 => Ok(PlayingCards::PlayingCardTrumpDash20),
PLAYING_CARD_TRUMP_DASH_21 => Ok(PlayingCards::PlayingCardTrumpDash21),
_ => Err(()),
}
}
}
impl Into<u32> for PlayingCards {
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 PlayingCards {
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 PlayingCards {
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 PlayingCards {
pub fn new() -> Self {
PlayingCards::PlayingCardBack
}
pub fn name(&self) -> &str {
match self {
PlayingCards::PlayingCardBack => "playing card back",
PlayingCards::PlayingCardAceOfSpades => "playing card ace of spades",
PlayingCards::PlayingCardTwoOfSpades => "playing card two of spades",
PlayingCards::PlayingCardThreeOfSpades => "playing card three of spades",
PlayingCards::PlayingCardFourOfSpades => "playing card four of spades",
PlayingCards::PlayingCardFiveOfSpades => "playing card five of spades",
PlayingCards::PlayingCardSixOfSpades => "playing card six of spades",
PlayingCards::PlayingCardSevenOfSpades => "playing card seven of spades",
PlayingCards::PlayingCardEightOfSpades => "playing card eight of spades",
PlayingCards::PlayingCardNineOfSpades => "playing card nine of spades",
PlayingCards::PlayingCardTenOfSpades => "playing card ten of spades",
PlayingCards::PlayingCardJackOfSpades => "playing card jack of spades",
PlayingCards::PlayingCardKnightOfSpades => "playing card knight of spades",
PlayingCards::PlayingCardQueenOfSpades => "playing card queen of spades",
PlayingCards::PlayingCardKingOfSpades => "playing card king of spades",
PlayingCards::PlayingCardAceOfHearts => "playing card ace of hearts",
PlayingCards::PlayingCardTwoOfHearts => "playing card two of hearts",
PlayingCards::PlayingCardThreeOfHearts => "playing card three of hearts",
PlayingCards::PlayingCardFourOfHearts => "playing card four of hearts",
PlayingCards::PlayingCardFiveOfHearts => "playing card five of hearts",
PlayingCards::PlayingCardSixOfHearts => "playing card six of hearts",
PlayingCards::PlayingCardSevenOfHearts => "playing card seven of hearts",
PlayingCards::PlayingCardEightOfHearts => "playing card eight of hearts",
PlayingCards::PlayingCardNineOfHearts => "playing card nine of hearts",
PlayingCards::PlayingCardTenOfHearts => "playing card ten of hearts",
PlayingCards::PlayingCardJackOfHearts => "playing card jack of hearts",
PlayingCards::PlayingCardKnightOfHearts => "playing card knight of hearts",
PlayingCards::PlayingCardQueenOfHearts => "playing card queen of hearts",
PlayingCards::PlayingCardKingOfHearts => "playing card king of hearts",
PlayingCards::PlayingCardRedJoker => "playing card red joker",
PlayingCards::PlayingCardAceOfDiamonds => "playing card ace of diamonds",
PlayingCards::PlayingCardTwoOfDiamonds => "playing card two of diamonds",
PlayingCards::PlayingCardThreeOfDiamonds => "playing card three of diamonds",
PlayingCards::PlayingCardFourOfDiamonds => "playing card four of diamonds",
PlayingCards::PlayingCardFiveOfDiamonds => "playing card five of diamonds",
PlayingCards::PlayingCardSixOfDiamonds => "playing card six of diamonds",
PlayingCards::PlayingCardSevenOfDiamonds => "playing card seven of diamonds",
PlayingCards::PlayingCardEightOfDiamonds => "playing card eight of diamonds",
PlayingCards::PlayingCardNineOfDiamonds => "playing card nine of diamonds",
PlayingCards::PlayingCardTenOfDiamonds => "playing card ten of diamonds",
PlayingCards::PlayingCardJackOfDiamonds => "playing card jack of diamonds",
PlayingCards::PlayingCardKnightOfDiamonds => "playing card knight of diamonds",
PlayingCards::PlayingCardQueenOfDiamonds => "playing card queen of diamonds",
PlayingCards::PlayingCardKingOfDiamonds => "playing card king of diamonds",
PlayingCards::PlayingCardBlackJoker => "playing card black joker",
PlayingCards::PlayingCardAceOfClubs => "playing card ace of clubs",
PlayingCards::PlayingCardTwoOfClubs => "playing card two of clubs",
PlayingCards::PlayingCardThreeOfClubs => "playing card three of clubs",
PlayingCards::PlayingCardFourOfClubs => "playing card four of clubs",
PlayingCards::PlayingCardFiveOfClubs => "playing card five of clubs",
PlayingCards::PlayingCardSixOfClubs => "playing card six of clubs",
PlayingCards::PlayingCardSevenOfClubs => "playing card seven of clubs",
PlayingCards::PlayingCardEightOfClubs => "playing card eight of clubs",
PlayingCards::PlayingCardNineOfClubs => "playing card nine of clubs",
PlayingCards::PlayingCardTenOfClubs => "playing card ten of clubs",
PlayingCards::PlayingCardJackOfClubs => "playing card jack of clubs",
PlayingCards::PlayingCardKnightOfClubs => "playing card knight of clubs",
PlayingCards::PlayingCardQueenOfClubs => "playing card queen of clubs",
PlayingCards::PlayingCardKingOfClubs => "playing card king of clubs",
PlayingCards::PlayingCardWhiteJoker => "playing card white joker",
PlayingCards::PlayingCardFool => "playing card fool",
PlayingCards::PlayingCardTrumpDash1 => "playing card trump-1",
PlayingCards::PlayingCardTrumpDash2 => "playing card trump-2",
PlayingCards::PlayingCardTrumpDash3 => "playing card trump-3",
PlayingCards::PlayingCardTrumpDash4 => "playing card trump-4",
PlayingCards::PlayingCardTrumpDash5 => "playing card trump-5",
PlayingCards::PlayingCardTrumpDash6 => "playing card trump-6",
PlayingCards::PlayingCardTrumpDash7 => "playing card trump-7",
PlayingCards::PlayingCardTrumpDash8 => "playing card trump-8",
PlayingCards::PlayingCardTrumpDash9 => "playing card trump-9",
PlayingCards::PlayingCardTrumpDash10 => "playing card trump-10",
PlayingCards::PlayingCardTrumpDash11 => "playing card trump-11",
PlayingCards::PlayingCardTrumpDash12 => "playing card trump-12",
PlayingCards::PlayingCardTrumpDash13 => "playing card trump-13",
PlayingCards::PlayingCardTrumpDash14 => "playing card trump-14",
PlayingCards::PlayingCardTrumpDash15 => "playing card trump-15",
PlayingCards::PlayingCardTrumpDash16 => "playing card trump-16",
PlayingCards::PlayingCardTrumpDash17 => "playing card trump-17",
PlayingCards::PlayingCardTrumpDash18 => "playing card trump-18",
PlayingCards::PlayingCardTrumpDash19 => "playing card trump-19",
PlayingCards::PlayingCardTrumpDash20 => "playing card trump-20",
PlayingCards::PlayingCardTrumpDash21 => "playing card trump-21",
}
}
}