Struct deckofcards::Hand [] [src]

pub struct Hand {
    pub cards: Vec<Card>,
}

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.

Fields

Methods

impl Hand
[src]

Make a new empty Hand

Makes a Hand from an existing hand

Makes a Hand from a slice

Constructs a Hand from a slice of strings with abbreviated card rank / suit values

Adds one Card to the Hand

Adds zero or more cards to the Hand

Adds zero or more cards from some other Hand

Returns the number of cards

Clears the Hand (makes it empty)

Removes a Card from the Hand and returns it, panics if index does not exist

Removes the first instance of every matching card from the Hand

Removes first instance of the matching card from the Hand

Returns cards of the specified Rank

Returns cards of the specified Suit

Trait Implementations

impl Display for Hand
[src]

Formats the value using the given formatter.

impl Clone for Hand
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> AddAssign<&'a Hand> for Hand
[src]

The method for the += operator

impl AddAssign<Card> for Hand
[src]

The method for the += operator

impl Cards for Hand
[src]

Shuffle the cards into a random order

Sort the cards by suit and then by rank (low to high)

Sorts the cards by suit and then by rank (high to low)

Sort the cards by rank (high to low) and then by suit