In this post, we will walk through Tim Visee’s solution to the day 5 Advent of Code Rust problem. The aim of this blog post is to not explain the solution to this problem, which is already explained in other blogs very well. Instead, I aim to explain the several idiomatic expressions in Tim’s terse Rust code for folks new to Rust.
These macros load the contents of a file into the codei, but at compile time itself! The variable will have a type
&'static str! (see docs) ADD NOTE ON SPACE REQUIREMENTS? Is it better to iterate line by line at runtime?
The original code had three
split_once calls and several
parse calls. Even in
--release mode, the compiler cannot optimize away the safety checks and the bounds checks in these calls (see godbolt sample here).
So this is that blog I never ended up finishing.