advent-of-code-2023/src/utils.rs

14 lines
342 B
Rust
Raw Normal View History

pub trait Day: std::fmt::Debug {
fn part1(&mut self) -> String;
fn part2(&mut self) -> String;
fn parse(&mut self) {}
fn solve(&mut self, part: u8) -> String {
self.parse();
match part {
1 => self.part1(),
2 => self.part2(),
_ => panic!("Invalid part #"),
}
}
}