25 lines
689 B
Rust
25 lines
689 B
Rust
pub trait Day: std::fmt::Debug {
|
|
fn part1(&mut self) -> String;
|
|
fn part2(&mut self) -> String;
|
|
fn part1_large(&mut self) -> String {
|
|
self.part1()
|
|
}
|
|
fn part2_large(&mut self) -> String {
|
|
self.part2()
|
|
}
|
|
fn parse(&mut self) {}
|
|
fn solve(&mut self, part: u8, large: bool) -> String {
|
|
self.parse();
|
|
match part {
|
|
1 => match large {
|
|
false => self.part1(),
|
|
true => self.part1_large(),
|
|
},
|
|
2 => match large {
|
|
false => self.part2(),
|
|
true => self.part2_large(),
|
|
},
|
|
_ => panic!("Invalid part #"),
|
|
}
|
|
}
|
|
}
|