Function advent_of_code_2021::day_8::parse_line[−][src]

fn parse_line(line: &str) -> Display
Expand description

This does all of the hard work. Once the input is turned into a Display the puzzle solution is easy to calculate. The string is split up by the | and ’ ’ delimeteters and the resulting 14 digits are parsed using Digit::from_str. Then there are the three loops discussed in the preamble that identify 1, 4, 7 and 8; 0, 6 and 9, then finally 2, 3, and 5. Building the digits map needed for Display as numbers are found.