Expand description
Card primitives: ranks, cards, holdings, and hands.
Rank is a non-zero byte in 2..=14 (J/Q/K/A as 11/12/13/14).
Card pairs a Rank with a Suit and packs into a
single byte. Holding is a 13-bit bitset of ranks within one suit,
and Hand is four holdings packed into a u64. Set operations on
holdings and hands are exposed through the standard bitwise operators.
Iteration yields cards in descending suit order (spades first) and descending rank order within each suit, matching the conventional display order.
§Panic policy
Rank::new panics when the input is outside 2..=14 and has
Rank::try_new for fallible construction. In const contexts the panic
becomes a compile-time error.
Structs§
- Card
- A playing card
- Hand
- A hand of playing cards
- Hand
Iter - Iterator over the cards in a
Hand, yieldingCards in descending suit order and descending rank order within each suit - Holding
- A set of cards of the same suit
- Holding
Iter - Iterator over the ranks in a
Holding, yieldingRanks in descending order - Invalid
Rank - Error indicating an invalid rank
- Parse
Rank Error - Error returned when parsing a
Rankfails - Rank
- The rank of a card, from 2 to 14, where J, Q, K, A are internally denoted as 11, 12, 13, 14 respectively.
Enums§
- Parse
Card Error - Error returned when parsing a
Cardfails - Parse
Hand Error - An error which can be returned when parsing a
Hand - Parse
Holding Error - An error which can be returned when parsing a
Holding