Function advent_of_code_2021::day_3::parse_input [−][src]
Expand description
Returns a pair of the parsed data and the length of the bit strings. Delegates to the built in
[usifix ze::from_str_radix]. The length is needed for some of the bitwise tricks.
Example from puzzle specification
let input =
"00100\n11110\n10110\n10111\n10101\n01111\n00111\n11100\n10000\n11001\n00010\n01010"
.to_string();
let (data, length) = parse_input(input);
assert_eq!(length, 5);
assert_eq!(
data,
vec![
0b00100,
0b11110,
0b10110,
0b10111,
0b10101,
0b01111,
0b00111,
0b11100,
0b10000,
0b11001,
0b00010,
0b01010,
]
)