diff --git a/aoc_2022/src/lib.rs b/aoc_2022/src/lib.rs index 3ea210f..7d6dfa8 100644 --- a/aoc_2022/src/lib.rs +++ b/aoc_2022/src/lib.rs @@ -1,5 +1,6 @@ use common as problem; use common::Solution; +use problem::DummySolution; mod aoc_lib; mod day_01; @@ -47,11 +48,11 @@ pub const ALL: [&dyn Solution; 25] = [ &day_16::Day16, &day_17::Day17, &day_18::Day18, - &day_19::Day19, + &DummySolution, &day_20::Day20, &day_21::Day21, &day_22::Day22, &day_23::Day23, - &day_24::Day24, + &DummySolution, &day_25::Day25, ]; diff --git a/common/src/lib.rs b/common/src/lib.rs index 64dae96..64d82ad 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -4,6 +4,10 @@ pub trait Solution { fn name(&self) -> &'static str; fn part_a(&self) -> String; fn part_b(&self) -> String; + + fn is_dummy(&self) -> bool { + false + } } pub fn load(year: u32, day: u32) -> String { @@ -14,3 +18,23 @@ pub fn load_raw(year: u32, day: u32) -> String { let file = format!("data/{year}/{:02}.txt", day); fs::read_to_string(&file).unwrap_or_else(|_| panic!("Error reading file {}", file)) } + +pub struct DummySolution; + +impl Solution for DummySolution { + fn name(&self) -> &'static str { + unimplemented!() + } + + fn part_a(&self) -> String { + unimplemented!() + } + + fn part_b(&self) -> String { + unimplemented!() + } + + fn is_dummy(&self) -> bool { + true + } +} diff --git a/src/main.rs b/src/main.rs index 239a05a..2cf7774 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,7 +41,7 @@ fn main() { let solutions = get_year(year); println!("[*] Solutions for {year}:"); - for (i, e) in solutions.iter().enumerate() { + for (i, e) in solutions.iter().enumerate().filter(|(_, e)| !e.is_dummy()) { println!( " {} Day {}: {}", if i + 1 == solutions.len() {