Expand description
§PLAYIN-CARDS
A crate for representing, formatting, and parsing French-Suited playing cards. The main objective of the project is to provide utility to crates implementing card games or card-game analysis.
§Design
In keeping with the goals of being a lightweight library, as well as best
practices with regard to separation of
concerns, playin-cards
is designed to be minimal, limiting its scope only the representation and
conversion of playing cards. As such, it does not not provide shuffling, the
concept of hands, or the concept of rank values. Such concerns are specific to
the application using playin-cards and are therefore left to consumers to
implement. This design maximizes the breadth of use-cases of playin-cards
while minimizing its dependencies.
§Features
- Jokers
- Iterable ranks and suits
- ASCII and Unicode representations of cards, ranks, and suits
- Copy semantics for all types
- Single character representations of cards: 🃞
- Convert single
charto rank or suit - Convert 2-character
strto card - Generate a shoe of arbitrary number of decks, with or without Jokers
§Usage
The main interface is the Card which represents a single playing card
which may be one of the cards in a standard 52-card deck of playing cards,
or a Joker which may be either black or red. A Card instance can be
easily be parsed from a 2-char str with one of A23456789TJQK as the
first char and one of SsCcDdHh♥♣♠♦ as the second char.
Card can also be formatted as a 2-char unicode string such A♣, 5♥,
J♠ with the Display trait or as a sinlg-char unicode card char such
as 🃑, 🂵, 🂫 with the UpperHex trait.
Structs§
Enums§
- Card
- A French-suited playing card
- Color
- Color of a
SuitorCard. Either Red or Black - Parse
Error - Error Type for parsing failures
- Rank
- Ranks of a standard French-suited playing card
- Suit
- Suits of a standard French-suited playing card
Constants§
- CARDS_
PER_ DECK - number of cards in a standard 52-card deck of French-suited playing cards