Function advent_of_code_2021::day_14::into_count_by[−][src]

fn into_count_by(
    polymer: &HashMap<(char, char), usize>,
    mapping: for<'a> fn(_: &'a (&(char, char), &usize)) -> char
) -> HashMap<char, usize>
Expand description

Reduce the pair mapping into a count of characters. This needs to be called twice once for each element in the pair, to account for the first and last character that are each only in one pair. The mapping parameter is to capture this difference, and maps a pair count entry from the Polymer into the character this invocation cares about