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, this crate is designed to be minimal in scope, limiting itself only the representation, parsing, and formatting of playing cards. As such, it does not not provide shuffling or the concept of hands; it attempts to remain independent of any specific card game or rules and focuses only on properties that are truly intrinsic to the cards themselves. That said, design decisions are made, where possible, to provide a featureful and ergonomic base to easily build most common card games, while still remaining generic enough to implement any card game played with a standard deck. This design philosophy maximizes the breadth of use-cases while minimizing dependencies.
Implementing concepts like hands and shuffling remains the responsibility of consumer
applications. They can easily do these things in obvious ways, for example, by collecting
[Card] values into a collection such as [array] or [Vec] to represent a hand, or making
use of the popular external crate rand to provide
random shuffling.
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