card: new card constructor
This commit is contained in:
@@ -36,6 +36,14 @@ impl Rank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Card {
|
impl Card {
|
||||||
|
pub fn new(rank: Rank, suit: Suit) -> Self {
|
||||||
|
Self::PlayingCard {
|
||||||
|
deck: 0,
|
||||||
|
rank,
|
||||||
|
suit,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_joker(&self) -> bool {
|
pub fn is_joker(&self) -> bool {
|
||||||
matches!(self, Self::Joker(_))
|
matches!(self, Self::Joker(_))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user