use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum DucyError {
InvalidRank,
InvalidSuit,
InvalidCard,
NotEnoughCards,
CardsNotAvailable,
IncorrectCardCount,
TooManyCommunityCards,
FlopNotSet,
TurnNotSet,
InvalidRange,
TooManyPlayers,
InvalidBoardIndex,
}
impl fmt::Display for DucyError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
DucyError::InvalidRank => write!(f, "invalid rank character"),
DucyError::InvalidSuit => write!(f, "invalid suit character"),
DucyError::InvalidCard => write!(f, "invalid card string"),
DucyError::NotEnoughCards => write!(f, "not enough cards in deck"),
DucyError::CardsNotAvailable => write!(f, "cards not available in deck"),
DucyError::IncorrectCardCount => write!(f, "incorrect number of cards"),
DucyError::TooManyCommunityCards => write!(f, "too many community cards"),
DucyError::FlopNotSet => write!(f, "flop must be set before turn"),
DucyError::TurnNotSet => write!(f, "turn must be set before river"),
DucyError::InvalidRange => write!(f, "invalid range specification"),
DucyError::TooManyPlayers => write!(f, "too many players (maximum 10)"),
DucyError::InvalidBoardIndex => write!(f, "board index out of range"),
}
}
}
impl std::error::Error for DucyError {}