Function aoc::year2022::day13::compare

source ·
fn compare(left: &str, right: &str) -> bool
Expand description

Compare 2 packets using the rules listed in the module description.

It’s faster to use 2 temporary vecs to store extra characters, rather than copy each packet into a mutable VecDeque. We use the or_else method on Option to check in the temporary vec for available characters first.