deckofcards 0.3.4

An API to implement a deck of cards

Crate deckofcards [] [src]

Macros

card

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.

combine_hands

Creates a new Hand that is the combination two hands into one hand. This does not consume the original hands.

deck

Creates a standard deck of 52 playing cards

hand

Creates a Hand of cards from the list of abbreviated cards string specified by rank / suit,

Structs

Card

A Card has a Rank and a Suit and represents a card from the normal 52-card playing deck.

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.

Hand

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

Rank

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

Suit

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

Traits

Cards

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

Functions

cards_of_rank

Returns cards of the specified rank

cards_of_suit

Returns cards of the specified suit