standard_card 1.2.0

A Lightweight Library for Efficient Card Representation
Documentation
//! # Card
//!
//! A card is an integer is made up of four bytes. The high-order bytes are used to hold the rank
//! bit pattern, whereas the low-order bytes hold the suit/rank/prime value of the card.
//!
//! | xxxAKQJT | 98765432 | cdhsrrrr | sspppppp |
//! | :------: | :------: | :------: | :------: |
//! | xxxbbbbb | bbbbbbbb | cdhsrrrr | sspppppp |
//!
//! Where
//!
//! | Key  | Definition                                                           |
//! | :--: | -------------------------------------------------------------------- |
//! |  p   | Prime number of rank                                                 |
//! |  s   | Suit of card (clubs=00, diamonds=01, hearts=10, spades=11)           |
//! |  r   | Rank of card                                                         |
//! | cdhs | bit turned on depending on suit of card (spades=0001,...,clubs=1000) |
//! |  b   | bit turned on depending on rank of card                              |
//!
//! As an example, the Five of Hearts would be represented as
//!
//! | xxxAKQJT | 98765432 | cdhsrrrr | sspppppp |                       |
//! | :------: | :------: | :------: | :------: | :-------------------: |
//! | 00000000 | 00001000 | 00100011 | 01000111 | = 0x00082347 = 533319 |
//!
//! More information about the card is presented in a table below
//!
//! |        | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 10  | J   | Q   | K   | A   |
//! | ------ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
//! | Ranks  | 0   | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 10  | 11  | 12  |
//! | Primes | 2   | 3   | 5   | 7   | 11  | 13  | 17  | 19  | 23  | 29  | 31  | 37  | 41  |

mod create;
mod get_primes;
mod get_rank;
mod get_suit;
mod is_black;
mod is_clubs;
mod is_diamonds;
mod is_hearts;
mod is_red;
mod is_spades;
mod rank_of;
mod to_string;

pub use create::create;
pub use get_primes::get_primes;
pub use get_rank::get_rank;
pub use get_suit::get_suit;
pub use is_black::is_black;
pub use is_clubs::is_clubs;
pub use is_diamonds::is_diamonds;
pub use is_hearts::is_hearts;
pub use is_red::is_red;
pub use is_spades::is_spades;
pub use rank_of::rank_of;
pub use to_string::to_string;