fn count_symbols(decklist: &ParsedDeck) -> HashMap<char, i16> {
    let symbol_re = Regex::new(r"\{(?P<symbol>W|U|B|R|G)\}").unwrap();
    let mut counts = HashMap::new();
    for card_ in decklist {
        if let Some(ref cost) = card_.manacost {
            for cap in symbol_re.captures_iter(&cost) {
                *counts
                    .entry(cap["symbol"].chars().nth(0).unwrap())
                    .or_insert(0) += 1;
            }
        }
    }
    counts
}
/// Count the number of mana symbols of each color in the deck. Hybrid mana is
/// not counted.
Count the number of mana symbols of each color in the deck. Hybrid mana is
not counted.
Count the number of mana symbols of each color in the deck . Hybrid mana is not counted .
fn count_symbols(decklist: &ParsedDeck) -> HashMap<char, i16> {
    let symbol_re = Regex::new(r"\{(?P<symbol>W|U|B|R|G)\}").unwrap();
    let mut counts = HashMap::new();
    for card_ in decklist {
        if let Some(ref cost) = card_.manacost {
            for cap in symbol_re.captures_iter(&cost) {
                *counts
                    .entry(cap["symbol"].chars().nth(0).unwrap())
                    .or_insert(0) += 1;
            }
        }
    }
    counts
}
fn count_symbols ( decklist : & ParsedDeck ) -> HashMap < char , i16 > { let symbol_re = Regex :: new ( r"\{(?P<symbol>W|U|B|R|G)\}" ) . unwrap ( ) ; let mut counts = HashMap :: new ( ) ; for card_ in decklist { if let Some ( ref cost ) = card_ . manacost { for cap in symbol_re . captures_iter ( & cost ) { * counts . entry ( cap [ " " ] . chars ( ) . nth ( 0 ) . unwrap ( ) ) . or_insert ( 0 ) += 1 ; } } } counts }
Count the number of mana symbols of each color in the deck.
Count the number of mana symbols of each color in the deck .
decklist
&ParsedDeck
decklist
&ParsedDeck