4 ms·
As someone who also completed Advent of Code in Rust this year this was very interesting. I agree it is a great way to learn more about a new language. Thanks f
by tlent 8y ago
As someone who also completed Advent of Code in Rust this year this was very interesting. I agree it is a great way to learn more about a new language. Thanks for sharing!
It seems like we ran into a lot of the same pain points like parsing, lack of a min-heap, etc.
Regarding HashMap initialization the best way I'm aware of to do what you are looking for is with lazy_static[0]. Maybe not very clean or idiomatic though.
For sorting I found the best solution to that problem was using sort_by_key with a tuple like (a.year, a.month, a.day, a.hour, a.minute).
[0]: https://github.com/rust-lang-nursery/lazy-static.rs#example https://github.com/rust-lang-nursery/lazy-static.rs#example