Instead of changing the main.rs file every day, I'll suggest creating a separate file for each day inside src/bin directory. That way, you can execute them using cargo run --bin day_1. Small but well thought out features like this is why I love Rust so much. For example, you can look at my repo at github.com/shritesh/advent-of-code
I hope to get through all of the challenges this year and learn from everyone here.
I'm a Sr. Software Engineer at Flashpoint. I specialize in Python and Go, building functional, practical, and maintainable web systems leveraging Kubernetes and the cloud. Blog opinions are my own.
I'm doing AoC with Rust too and the solution I came up with looks almost exactly like yours.
Part 1
Part 2: I used a HashSet
Instead of changing the main.rs file every day, I'll suggest creating a separate file for each day inside
src/bindirectory. That way, you can execute them usingcargo run --bin day_1. Small but well thought out features like this is why I love Rust so much. For example, you can look at my repo at github.com/shritesh/advent-of-codeI hope to get through all of the challenges this year and learn from everyone here.
Oooh! Good idea! Iām definitely doing that. Thanks!