LemmingAvalanche / aoc-2022

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

See: https://adventofcode.com/2022

Resources

Snippets and common problems

lines()

I often have problems with this iterator.

Collecting into a Vec can help. Then you can use slice iterators, which tend to be more forgiving.

        .lines()
        [what is inbetween—probably one or more `map()`]
        .collect::<Vec<u32>>();

lines() into numbers

[]
        .lines()
        .map(|s| s.parse::<u32>().expect("not an integer"));

Parsing trouble: feedback and help on Day 5

I wasn’t happy with my approach to parsing so I asked someone.

About


Languages

Language:Rust 100.0%