Struct deckofcards::Deck [] [src]

pub struct Deck { /* fields omitted */ }

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.

The deck may be reset to return it to its original state. A deck may be shuffled to randomize its order.

A deck can contain more than one card with the same rank / suit combination.

A deck cannot have more cards added or removed to it once it is created.

Methods

impl Deck
[src]

Creates a new Deck containing the standard set of 52 cards

Creates a new Deck containing the specified cards

Returns the number of remaining undealt cards in the Deck

Returns the number of dealt cards in the Deck

Returns the number of cards, dealt or undealt, within the Deck

Returns the collection of dealt cards

Deals the card from the undealt pile. If there are no cards left, the function will return an error.

Deals one or more card from the undealt pile and returns them as an array.

Deals one or more card straight to the Hand. Returns the number of cards dealt.

Return the dealt cards back to the end of the undealt pile. Order is preserved according to the default order or the last shuffle.

Resets and shuffles the deck

Trait Implementations

impl Cards for Deck
[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

impl Clone for Deck
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more