Add macro for static day 5 parsing

This commit is contained in:
kageru 2021-12-05 23:38:23 +01:00
parent d0a72cb04e
commit 78de4f1d46
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

View File

@ -7,6 +7,15 @@ const DAY: usize = 5;
type Coordinate = (i16, i16); // twice as fast as using i64s ¯\_(ツ)_/¯
type Parsed = Vec<(Coordinate, Coordinate)>;
// Memes :pepeHype:
/*
macro_rules! parse {
($($x1: literal, $y1: literal -> $x2: literal, $y2: literal)*) => {
[ $((($x1, $y1), ($x2, $y2)),)* ]
};
}
*/
fn parse_input(raw: &str) -> Parsed {
raw.lines()
.filter_map(|line| line.split_once(" -> "))