From 78de4f1d460b566f709219acf178a5b61e84d1d1 Mon Sep 17 00:00:00 2001 From: kageru Date: Sun, 5 Dec 2021 23:38:23 +0100 Subject: [PATCH] Add macro for static day 5 parsing --- 2021/src/bin/day05.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/2021/src/bin/day05.rs b/2021/src/bin/day05.rs index 670922b..df55afe 100644 --- a/2021/src/bin/day05.rs +++ b/2021/src/bin/day05.rs @@ -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(" -> "))