cards

Macro cards 

Source
macro_rules! cards {
    ($card_str:expr) => { ... };
}
Expand description

A macro to create a Pile of Standard52 cards from a string.

This is a tool of convenience that is a lot more forgiving than the standard Pile::from_str call. If the call doesn’t recognize the string as Cards it will simply return an empty Pile.

use cardpack::prelude::*;
assert_eq!(cards!("AC KC QC JC TC").to_string(), "A♣ K♣ Q♣ J♣ T♣");

For example, since the Big Joker isn’t in the Standard52 Deck, the cards macro will return an empty Pile:

use cardpack::prelude::*;
assert!(cards!("A♠ B🃟 Q♠ J♠ T♠").to_string().is_empty());