Crate deckofcards

source ·

Macros

Creates a Card and sets its rank / suit from its abbreviated string description. The description is of the form “RS”, Rank followed by Suit, e.g. “2D” for Two of Diamonds.
Creates a new Hand that is the combination two hands into one hand. This does not consume the original hands.
Creates a standard deck of 52 playing cards
Creates a Hand of cards from the list of abbreviated cards string specified by rank / suit,

Structs

A Card has a Rank and a Suit and represents a card from the normal 52-card playing deck.
The Deck represents a deck of zero or more cards. Internally the deck consists of an undealt and a dealt pile of cards. The undealt pile starts off empty and receives cards as they are dealt from the undealt pile.
A Hand is zero or more cards that represents some aspect of a game, e.g. the cards a person is holding. A hand may be shuffled or sorted and there are functions for adding or removing cards. Unlike a Deck, there is no concept of dealt or undealt cards.

Enums

This enumeration holds the ranks in a standard deck of cards.
This enumeration holds the suits in a standard deck of cards.

Traits

Certain actions are common to a deck and a hand of cards

Functions

Returns cards of the specified rank
Returns cards of the specified suit