Advent of code in Rust - solving day 2/2021 (Twitch Live 2022-01-17)

preview_player
Показать описание
In this episode, we completed day 2 of Advent of Code y2021 using Rust!

This exercise required us to do a little bit of parsing to process a sequence of instructions that would make a submarine move.

The solution was simple enough but we wanted to get a bit fancy and experiment a little bit.

But hey, sometimes you just want to have fun and try something new :)

The first and the second part of the exercise had a few repeated bits that we thought could use some refactoring.

We ended up experimenting with custom traits and blanket implementations, only to find out that you cannot really provide a blanket implementation for another trait without having a wrapper struct.

This was an interesting learning, but in the end, we didn't think it made our solution simpler so we ended up ditching those changes.

If you have any suggestion, we'd love to hear it, so please leave a comment or a create a PR!

Рекомендации по теме