summaryrefslogtreecommitdiff
path: root/2024_rust/src/lib.rs
diff options
context:
space:
mode:
authorGuillermo Ramos2024-12-06 15:59:32 +0100
committerGuillermo Ramos2024-12-06 16:29:18 +0100
commitff064b6f13019b15346ff320a486d70b95d80b2a (patch)
tree396868cbbd9be95f6ce0a808f8436d4a1a0f1d89 /2024_rust/src/lib.rs
parenta6029017bb354381c17afaf00526442966648c3f (diff)
downloadAoC-ff064b6f13019b15346ff320a486d70b95d80b2a.tar.gz
Each day is now a binary
Diffstat (limited to '2024_rust/src/lib.rs')
-rw-r--r--2024_rust/src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/2024_rust/src/lib.rs b/2024_rust/src/lib.rs
new file mode 100644
index 0000000..f8a84d6
--- /dev/null
+++ b/2024_rust/src/lib.rs
@@ -0,0 +1,12 @@
+pub fn run_day<S1, S2>(day: &str, p1: S1, p2: S2)
+where
+ S1: FnOnce(&str) -> String,
+ S2: FnOnce(&str) -> String,
+{
+ let input_file = format!("inputs/{day}");
+ let input = std::fs::read_to_string(input_file).unwrap();
+
+ println!("==== DAY {day}");
+ println!("Result (P1): {}", p1(&input));
+ println!("Result (P2): {}", p2(&input));
+}