summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2023-12-01 18:17:33 -0600
committerToby Vincent <tobyv@tobyvin.dev>2023-12-01 18:17:33 -0600
commit8525793927ad76a5ffa4a5f522b9a80c1a637644 (patch)
tree3b502ed3f841ac3e7498f8c4c802b86effeb97a2 /src/lib.rs
feat: impl day 1
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..a895a9d
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,27 @@
+pub mod day_01;
+
+pub trait Solution: Problem {
+ type Answer1: std::fmt::Display + Default;
+
+ type Answer2: std::fmt::Display + Default;
+
+ fn part_1(input: &str) -> anyhow::Result<Self::Answer1>;
+
+ fn part_2(input: &str) -> anyhow::Result<Self::Answer2>;
+
+ fn solve() -> anyhow::Result<()> {
+ println!("Day {}.1", Self::DAY);
+ println!("{}\n", Self::part_1(Self::INPUT)?);
+
+ println!("Day {}.2", Self::DAY);
+ println!("{}\n", Self::part_2(Self::INPUT)?);
+
+ Ok(())
+ }
+}
+
+pub trait Problem {
+ const DAY: u8;
+
+ const INPUT: &'static str;
+}