pub fn count_cards(&self) -> HashMap<Card, u16> {

        let mut res = HashMap::<Card, u16>::new();

        let mut current_sequence = &self.sequences;
        while *current_sequence != Nil {
            match current_sequence {
                Cons(seq, box_sl) => {
                    for card in seq.to_vec() {
                        if res.contains_key(&card) {
                            *res.get_mut(&card).unwrap() += 1;
                        } else {
                            res.insert(card, 1);
                        }
                    }
                    current_sequence = &*box_sl;
                },
                _ => ()
            }
        }
        
        return res;
    }
/// HashMap of the type and number of each card on the table
///
/// # Example
///
/// ```
/// use machiavelli::table::*;
/// use machiavelli::sequence_cards::*;
///
/// let mut table = Table::new();
/// table.add(Sequence::from_cards(&[
///     RegularCard(Club, 4), 
///     RegularCard(Club, 5), 
///     RegularCard(Club, 6), 
/// ]));
/// table.add(Sequence::from_cards(&[
///     RegularCard(Club, 2), 
///     RegularCard(Club, 3), 
///     RegularCard(Club, 4), 
/// ]));
/// 
/// let hm_cards = table.count_cards();
///
/// assert_eq!(1, hm_cards[&RegularCard(Club, 5)]);
/// assert_eq!(2, hm_cards[&RegularCard(Club, 4)]);
/// assert_eq!(false, hm_cards.contains_key(&RegularCard(Club, 7)));
/// ```
HashMap of the type and number of each card on the table
HashMap of the type and number of each card on the table
pub fn count_cards(&self) -> HashMap<Card, u16> {
        let mut res = HashMap::<Card, u16>::new();
        let mut current_sequence = &self.sequences;
        while *current_sequence != Nil {
            match current_sequence {
                Cons(seq, box_sl) => {
                    for card in seq.to_vec() {
                        if res.contains_key(&card) {
                            *res.get_mut(&card).unwrap() += 1;
                        } else {
                            res.insert(card, 1);
                        }
                    }
                    current_sequence = &*box_sl;
                },
                _ => ()
            }
        }
        return res;
    }
pub fn count_cards ( & self ) -> HashMap < Card , u16 > { let mut res = HashMap :: < Card , u16 > :: new ( ) ; let mut current_sequence = & self . sequences ; while * current_sequence != Nil { match current_sequence { Cons ( seq , box_sl ) => { for card in seq . to_vec ( ) { if res . contains_key ( & card ) { * res . get_mut ( & card ) . unwrap ( ) += 1 ; } else { res . insert ( card , 1 ) ; } } current_sequence = & * box_sl ; } , _ => ( ) } } return res ; }
HashMap of the type and number of each card on the table
HashMap of the type and number of each card on the table
&self
&self
example
```
use machiavelli::table::*;
use machiavelli::sequence_cards::*.

let mut table = Table::new();
table.add(Sequence::from_cards(&[
RegularCard(Club, 4),
RegularCard(Club, 5),
RegularCard(Club, 6),
]));
table.add(Sequence::from_cards(&[
RegularCard(Club, 2),
RegularCard(Club, 3),
RegularCard(Club, 4),
])).

let hm_cards = table.count_cards().

assert_eq!(1, hm_cards[&RegularCard(Club, 5)]);
assert_eq!(2, hm_cards[&RegularCard(Club, 4)]);
assert_eq!(false, hm_cards.contains_key(&RegularCard(Club, 7)));
```
` ` ` use machiavelli :: table :: * ; use machiavelli :: sequence_cards :: * . let mut table = Table :: new () ; table . add ( Sequence :: from_cards ( & [ RegularCard ( Club 4 ) RegularCard ( Club 5 ) RegularCard ( Club 6 ) ] )) ; table . add ( Sequence :: from_cards ( & [ RegularCard ( Club 2 ) RegularCard ( Club 3 ) RegularCard ( Club 4 ) ] )) . let hm_cards = table . count_cards () . assert_eq! ( 1 hm_cards [ &RegularCard ( Club 5 ) ] ) ; assert_eq! ( 2 hm_cards [ &RegularCard ( Club 4 ) ] ) ; assert_eq! ( false hm_cards . contains_key ( &RegularCard ( Club 7 ))) ; ` ` `