diff --git a/Cargo.toml b/Cargo.toml index 08fcbf1..44d1799 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] -async-trait = "0.1.74" -fancy-regex = "0.14.0" -hashbrown = "0.15.1" -itertools = "0.13.0" -strum = "0.26.3" -strum_macros = "0.26.4" tokio = {version = "1.41.1", features = ["full"]} diff --git a/create.py b/create.py index 80e836d..49ac506 100644 --- a/create.py +++ b/create.py @@ -1,4 +1,5 @@ + for day in range(1, 26): boilerplate = open(".\\src\\solutions\\dayxx.rs", "r").read() boilerplate = boilerplate.replace("0", str(day)) @@ -7,6 +8,6 @@ for day in range(1, 26): new_code = open(f".\\src\\solutions\\day{day:02d}.rs", "w") new_code.write(boilerplate) - f = open(f".\\src\\input\\day{day:02d}", "x") - f = open(f".\\src\\input\\day{day:02d}_test1", "x") - f = open(f".\\src\\input\\day{day:02d}_test2", "x") \ No newline at end of file + f = open(f".\\input\\day{day:02d}", "x") + f = open(f".\\input\\day{day:02d}_test1", "x") + f = open(f".\\input\\day{day:02d}_test2", "x") \ No newline at end of file diff --git a/src/input/day01 b/input/day01 similarity index 100% rename from src/input/day01 rename to input/day01 diff --git a/src/input/day01_test1 b/input/day01_test1 similarity index 100% rename from src/input/day01_test1 rename to input/day01_test1 diff --git a/src/input/day01_test2 b/input/day01_test2 similarity index 100% rename from src/input/day01_test2 rename to input/day01_test2 diff --git a/src/input/day02 b/input/day02 similarity index 100% rename from src/input/day02 rename to input/day02 diff --git a/src/input/day02_test1 b/input/day02_test1 similarity index 100% rename from src/input/day02_test1 rename to input/day02_test1 diff --git a/src/input/day02_test2 b/input/day02_test2 similarity index 100% rename from src/input/day02_test2 rename to input/day02_test2 diff --git a/src/input/day03 b/input/day03 similarity index 100% rename from src/input/day03 rename to input/day03 diff --git a/src/input/day03_test1 b/input/day03_test1 similarity index 100% rename from src/input/day03_test1 rename to input/day03_test1 diff --git a/src/input/day03_test2 b/input/day03_test2 similarity index 100% rename from src/input/day03_test2 rename to input/day03_test2 diff --git a/src/input/day04 b/input/day04 similarity index 100% rename from src/input/day04 rename to input/day04 diff --git a/src/input/day04_test1 b/input/day04_test1 similarity index 100% rename from src/input/day04_test1 rename to input/day04_test1 diff --git a/src/input/day04_test2 b/input/day04_test2 similarity index 100% rename from src/input/day04_test2 rename to input/day04_test2 diff --git a/src/input/day05 b/input/day05 similarity index 100% rename from src/input/day05 rename to input/day05 diff --git a/src/input/day05_test1 b/input/day05_test1 similarity index 100% rename from src/input/day05_test1 rename to input/day05_test1 diff --git a/src/input/day05_test2 b/input/day05_test2 similarity index 100% rename from src/input/day05_test2 rename to input/day05_test2 diff --git a/src/input/day06 b/input/day06 similarity index 100% rename from src/input/day06 rename to input/day06 diff --git a/src/input/day06_test1 b/input/day06_test1 similarity index 100% rename from src/input/day06_test1 rename to input/day06_test1 diff --git a/src/input/day06_test2 b/input/day06_test2 similarity index 100% rename from src/input/day06_test2 rename to input/day06_test2 diff --git a/src/input/day07 b/input/day07 similarity index 100% rename from src/input/day07 rename to input/day07 diff --git a/src/input/day07_test1 b/input/day07_test1 similarity index 100% rename from src/input/day07_test1 rename to input/day07_test1 diff --git a/src/input/day07_test2 b/input/day07_test2 similarity index 100% rename from src/input/day07_test2 rename to input/day07_test2 diff --git a/src/input/day08 b/input/day08 similarity index 100% rename from src/input/day08 rename to input/day08 diff --git a/src/input/day08_test1 b/input/day08_test1 similarity index 100% rename from src/input/day08_test1 rename to input/day08_test1 diff --git a/src/input/day08_test2 b/input/day08_test2 similarity index 100% rename from src/input/day08_test2 rename to input/day08_test2 diff --git a/src/input/day09 b/input/day09 similarity index 100% rename from src/input/day09 rename to input/day09 diff --git a/src/input/day09_test1 b/input/day09_test1 similarity index 100% rename from src/input/day09_test1 rename to input/day09_test1 diff --git a/src/input/day09_test2 b/input/day09_test2 similarity index 100% rename from src/input/day09_test2 rename to input/day09_test2 diff --git a/src/input/day10 b/input/day10 similarity index 100% rename from src/input/day10 rename to input/day10 diff --git a/src/input/day10_test1 b/input/day10_test1 similarity index 100% rename from src/input/day10_test1 rename to input/day10_test1 diff --git a/src/input/day10_test2 b/input/day10_test2 similarity index 100% rename from src/input/day10_test2 rename to input/day10_test2 diff --git a/src/input/day11 b/input/day11 similarity index 100% rename from src/input/day11 rename to input/day11 diff --git a/src/input/day11_test1 b/input/day11_test1 similarity index 100% rename from src/input/day11_test1 rename to input/day11_test1 diff --git a/src/input/day11_test2 b/input/day11_test2 similarity index 100% rename from src/input/day11_test2 rename to input/day11_test2 diff --git a/src/input/day12 b/input/day12 similarity index 100% rename from src/input/day12 rename to input/day12 diff --git a/src/input/day12_test1 b/input/day12_test1 similarity index 100% rename from src/input/day12_test1 rename to input/day12_test1 diff --git a/src/input/day12_test2 b/input/day12_test2 similarity index 100% rename from src/input/day12_test2 rename to input/day12_test2 diff --git a/src/input/day13 b/input/day13 similarity index 100% rename from src/input/day13 rename to input/day13 diff --git a/src/input/day13_test1 b/input/day13_test1 similarity index 100% rename from src/input/day13_test1 rename to input/day13_test1 diff --git a/src/input/day13_test2 b/input/day13_test2 similarity index 100% rename from src/input/day13_test2 rename to input/day13_test2 diff --git a/src/input/day14 b/input/day14 similarity index 100% rename from src/input/day14 rename to input/day14 diff --git a/src/input/day14_test1 b/input/day14_test1 similarity index 100% rename from src/input/day14_test1 rename to input/day14_test1 diff --git a/src/input/day14_test2 b/input/day14_test2 similarity index 100% rename from src/input/day14_test2 rename to input/day14_test2 diff --git a/src/input/day15 b/input/day15 similarity index 100% rename from src/input/day15 rename to input/day15 diff --git a/src/input/day15_test1 b/input/day15_test1 similarity index 100% rename from src/input/day15_test1 rename to input/day15_test1 diff --git a/src/input/day15_test2 b/input/day15_test2 similarity index 100% rename from src/input/day15_test2 rename to input/day15_test2 diff --git a/src/input/day16 b/input/day16 similarity index 100% rename from src/input/day16 rename to input/day16 diff --git a/src/input/day16_test1 b/input/day16_test1 similarity index 100% rename from src/input/day16_test1 rename to input/day16_test1 diff --git a/src/input/day16_test2 b/input/day16_test2 similarity index 100% rename from src/input/day16_test2 rename to input/day16_test2 diff --git a/src/input/day17 b/input/day17 similarity index 100% rename from src/input/day17 rename to input/day17 diff --git a/src/input/day17_test1 b/input/day17_test1 similarity index 100% rename from src/input/day17_test1 rename to input/day17_test1 diff --git a/src/input/day17_test2 b/input/day17_test2 similarity index 100% rename from src/input/day17_test2 rename to input/day17_test2 diff --git a/src/input/day18 b/input/day18 similarity index 100% rename from src/input/day18 rename to input/day18 diff --git a/src/input/day18_test1 b/input/day18_test1 similarity index 100% rename from src/input/day18_test1 rename to input/day18_test1 diff --git a/src/input/day18_test2 b/input/day18_test2 similarity index 100% rename from src/input/day18_test2 rename to input/day18_test2 diff --git a/src/input/day19 b/input/day19 similarity index 100% rename from src/input/day19 rename to input/day19 diff --git a/src/input/day19_test1 b/input/day19_test1 similarity index 100% rename from src/input/day19_test1 rename to input/day19_test1 diff --git a/src/input/day19_test2 b/input/day19_test2 similarity index 100% rename from src/input/day19_test2 rename to input/day19_test2 diff --git a/src/input/day20 b/input/day20 similarity index 100% rename from src/input/day20 rename to input/day20 diff --git a/src/input/day20_test1 b/input/day20_test1 similarity index 100% rename from src/input/day20_test1 rename to input/day20_test1 diff --git a/src/input/day20_test2 b/input/day20_test2 similarity index 100% rename from src/input/day20_test2 rename to input/day20_test2 diff --git a/src/input/day21 b/input/day21 similarity index 100% rename from src/input/day21 rename to input/day21 diff --git a/src/input/day21_test1 b/input/day21_test1 similarity index 100% rename from src/input/day21_test1 rename to input/day21_test1 diff --git a/src/input/day21_test2 b/input/day21_test2 similarity index 100% rename from src/input/day21_test2 rename to input/day21_test2 diff --git a/src/input/day22 b/input/day22 similarity index 100% rename from src/input/day22 rename to input/day22 diff --git a/src/input/day22_test1 b/input/day22_test1 similarity index 100% rename from src/input/day22_test1 rename to input/day22_test1 diff --git a/src/input/day22_test2 b/input/day22_test2 similarity index 100% rename from src/input/day22_test2 rename to input/day22_test2 diff --git a/src/input/day23 b/input/day23 similarity index 100% rename from src/input/day23 rename to input/day23 diff --git a/src/input/day23_test1 b/input/day23_test1 similarity index 100% rename from src/input/day23_test1 rename to input/day23_test1 diff --git a/src/input/day23_test2 b/input/day23_test2 similarity index 100% rename from src/input/day23_test2 rename to input/day23_test2 diff --git a/src/input/day24 b/input/day24 similarity index 100% rename from src/input/day24 rename to input/day24 diff --git a/src/input/day24_test1 b/input/day24_test1 similarity index 100% rename from src/input/day24_test1 rename to input/day24_test1 diff --git a/src/input/day24_test2 b/input/day24_test2 similarity index 100% rename from src/input/day24_test2 rename to input/day24_test2 diff --git a/src/input/day25 b/input/day25 similarity index 100% rename from src/input/day25 rename to input/day25 diff --git a/src/input/day25_test1 b/input/day25_test1 similarity index 100% rename from src/input/day25_test1 rename to input/day25_test1 diff --git a/src/input/day25_test2 b/input/day25_test2 similarity index 100% rename from src/input/day25_test2 rename to input/day25_test2 diff --git a/src/main.rs b/src/main.rs index 911bf28..f19220b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,44 +7,47 @@ use solutions::*; #[tokio::main] async fn main() -> Result<(), Box> { - let days: Vec> = vec![ + /* Uncomment these before the start of each day! */ + let days: Vec> = vec![ Box::new(day01::Day01 {}), - Box::new(day02::Day02 {}), - Box::new(day03::Day03 {}), - Box::new(day04::Day04 {}), - Box::new(day05::Day05 {}), - Box::new(day06::Day06 {}), - Box::new(day07::Day07 {}), - Box::new(day08::Day08 {}), - Box::new(day09::Day09 {}), - Box::new(day10::Day10 {}), - Box::new(day11::Day11 {}), - Box::new(day12::Day12 {}), - Box::new(day13::Day13 {}), - Box::new(day14::Day14 {}), - Box::new(day15::Day15 {}), - Box::new(day16::Day16 {}), - Box::new(day17::Day17 {}), - Box::new(day18::Day18 {}), - Box::new(day19::Day19 {}), - Box::new(day20::Day20 {}), - Box::new(day21::Day21 {}), - Box::new(day22::Day22 {}), - Box::new(day23::Day23 {}), - Box::new(day24::Day24 {}), - Box::new(day25::Day25 {}), + // Box::new(day02::Day02 {}), + // Box::new(day03::Day03 {}), + // Box::new(day04::Day04 {}), + // Box::new(day05::Day05 {}), + // Box::new(day06::Day06 {}), + // Box::new(day07::Day07 {}), + // Box::new(day08::Day08 {}), + // Box::new(day09::Day09 {}), + // Box::new(day10::Day10 {}), + // Box::new(day11::Day11 {}), + // Box::new(day12::Day12 {}), + // Box::new(day13::Day13 {}), + // Box::new(day14::Day14 {}), + // Box::new(day15::Day15 {}), + // Box::new(day16::Day16 {}), + // Box::new(day17::Day17 {}), + // Box::new(day18::Day18 {}), + // Box::new(day19::Day19 {}), + // Box::new(day20::Day20 {}), + // Box::new(day21::Day21 {}), + // Box::new(day22::Day22 {}), + // Box::new(day23::Day23 {}), + // Box::new(day24::Day24 {}), + // Box::new(day25::Day25 {}), ]; + // Vector to store every solution as a thread handle let mut t = vec![]; - // Run through and generate solutions - for day in days.leak() { - let task = tokio::spawn(async { day.run().unwrap() }); + // Run through and construct solution objects + for day in days { + let task = tokio::spawn(async move { day.run().unwrap() }); t.push(task); } let start_time = SystemTime::now(); + // When thread is awaited, the solution is run let mut days = vec![]; for thread in t { days.push(thread.await?); diff --git a/src/solutions/day01.rs b/src/solutions/day01.rs index b0d208b..9c6edbc 100644 --- a/src/solutions/day01.rs +++ b/src/solutions/day01.rs @@ -6,14 +6,14 @@ impl Solution for Day01 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day02.rs b/src/solutions/day02.rs index 7e58d97..3ca9181 100644 --- a/src/solutions/day02.rs +++ b/src/solutions/day02.rs @@ -6,14 +6,14 @@ impl Solution for Day02 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day03.rs b/src/solutions/day03.rs index d4d0571..eade51a 100644 --- a/src/solutions/day03.rs +++ b/src/solutions/day03.rs @@ -6,14 +6,14 @@ impl Solution for Day03 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day04.rs b/src/solutions/day04.rs index 75a66fa..9c3adcc 100644 --- a/src/solutions/day04.rs +++ b/src/solutions/day04.rs @@ -6,14 +6,14 @@ impl Solution for Day04 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day05.rs b/src/solutions/day05.rs index cb2fb84..5371019 100644 --- a/src/solutions/day05.rs +++ b/src/solutions/day05.rs @@ -6,14 +6,14 @@ impl Solution for Day05 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day06.rs b/src/solutions/day06.rs index 69ebe63..a874f45 100644 --- a/src/solutions/day06.rs +++ b/src/solutions/day06.rs @@ -6,14 +6,14 @@ impl Solution for Day06 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day07.rs b/src/solutions/day07.rs index 193959b..b73a00d 100644 --- a/src/solutions/day07.rs +++ b/src/solutions/day07.rs @@ -6,14 +6,14 @@ impl Solution for Day07 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day08.rs b/src/solutions/day08.rs index 4f5625d..d6c2668 100644 --- a/src/solutions/day08.rs +++ b/src/solutions/day08.rs @@ -6,14 +6,14 @@ impl Solution for Day08 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day09.rs b/src/solutions/day09.rs index 440897e..3ce348a 100644 --- a/src/solutions/day09.rs +++ b/src/solutions/day09.rs @@ -6,14 +6,14 @@ impl Solution for Day09 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day10.rs b/src/solutions/day10.rs index cf43118..3ab58ef 100644 --- a/src/solutions/day10.rs +++ b/src/solutions/day10.rs @@ -6,14 +6,14 @@ impl Solution for Day10 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day11.rs b/src/solutions/day11.rs index 1ebdf27..b019d00 100644 --- a/src/solutions/day11.rs +++ b/src/solutions/day11.rs @@ -6,14 +6,14 @@ impl Solution for Day11 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day12.rs b/src/solutions/day12.rs index c52afa4..f1ea006 100644 --- a/src/solutions/day12.rs +++ b/src/solutions/day12.rs @@ -6,14 +6,14 @@ impl Solution for Day12 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day13.rs b/src/solutions/day13.rs index 1239b6f..20a3ae8 100644 --- a/src/solutions/day13.rs +++ b/src/solutions/day13.rs @@ -6,14 +6,14 @@ impl Solution for Day13 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day14.rs b/src/solutions/day14.rs index 17c533f..eee2290 100644 --- a/src/solutions/day14.rs +++ b/src/solutions/day14.rs @@ -6,14 +6,14 @@ impl Solution for Day14 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day15.rs b/src/solutions/day15.rs index ef3fa2d..38322e2 100644 --- a/src/solutions/day15.rs +++ b/src/solutions/day15.rs @@ -6,14 +6,14 @@ impl Solution for Day15 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day16.rs b/src/solutions/day16.rs index ad4f610..9c1fe90 100644 --- a/src/solutions/day16.rs +++ b/src/solutions/day16.rs @@ -6,14 +6,14 @@ impl Solution for Day16 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day17.rs b/src/solutions/day17.rs index 496b72a..2f7dba5 100644 --- a/src/solutions/day17.rs +++ b/src/solutions/day17.rs @@ -6,14 +6,14 @@ impl Solution for Day17 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day18.rs b/src/solutions/day18.rs index f5a7b46..4db1e9c 100644 --- a/src/solutions/day18.rs +++ b/src/solutions/day18.rs @@ -6,14 +6,14 @@ impl Solution for Day18 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day19.rs b/src/solutions/day19.rs index e47c36a..babf9c7 100644 --- a/src/solutions/day19.rs +++ b/src/solutions/day19.rs @@ -6,14 +6,14 @@ impl Solution for Day19 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day20.rs b/src/solutions/day20.rs index ce72d5b..e4f3d4a 100644 --- a/src/solutions/day20.rs +++ b/src/solutions/day20.rs @@ -6,14 +6,14 @@ impl Solution for Day20 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day21.rs b/src/solutions/day21.rs index 7491fb8..f4ce049 100644 --- a/src/solutions/day21.rs +++ b/src/solutions/day21.rs @@ -6,14 +6,14 @@ impl Solution for Day21 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day22.rs b/src/solutions/day22.rs index e784924..a336b17 100644 --- a/src/solutions/day22.rs +++ b/src/solutions/day22.rs @@ -6,14 +6,14 @@ impl Solution for Day22 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day23.rs b/src/solutions/day23.rs index e38c818..6b12cef 100644 --- a/src/solutions/day23.rs +++ b/src/solutions/day23.rs @@ -6,14 +6,14 @@ impl Solution for Day23 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day24.rs b/src/solutions/day24.rs index 920f2e2..74be3fb 100644 --- a/src/solutions/day24.rs +++ b/src/solutions/day24.rs @@ -6,14 +6,14 @@ impl Solution for Day24 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/day25.rs b/src/solutions/day25.rs index 05193fe..1293500 100644 --- a/src/solutions/day25.rs +++ b/src/solutions/day25.rs @@ -6,14 +6,14 @@ impl Solution for Day25 { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/dayxx.rs b/src/solutions/dayxx.rs index 754bcab..7ee9fdf 100644 --- a/src/solutions/dayxx.rs +++ b/src/solutions/dayxx.rs @@ -6,14 +6,14 @@ impl Solution for DayXX { fn part1( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } fn part2( &self, _input: &mut Vec, - ) -> Result, Box> { + ) -> Result, Box> { Ok(Box::new("Ready")) } diff --git a/src/solutions/mod.rs b/src/solutions/mod.rs index 12cccc9..7b9f7a2 100644 --- a/src/solutions/mod.rs +++ b/src/solutions/mod.rs @@ -27,9 +27,9 @@ pub mod day25; use crate::utils::{self, get_input}; use std::{error::Error, fmt::Display, time::SystemTime}; -pub trait Solution { - fn part1(&self, input: &mut Vec) -> Result, Box>; - fn part2(&self, input: &mut Vec) -> Result, Box>; +pub trait Solution: Send + Sync { + fn part1(&self, input: &mut Vec) -> Result, Box>; + fn part2(&self, input: &mut Vec) -> Result, Box>; fn get_day(&self) -> u8; fn run(&self) -> Result> { @@ -49,8 +49,8 @@ pub trait Solution { } pub struct Run { - pub part1: Box, - pub part2: Box, + pub part1: Box, + pub part2: Box, pub day: u8, pub time: core::time::Duration, } diff --git a/src/utils.rs b/src/utils.rs index fbe3c16..6b75d79 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -16,9 +16,9 @@ pub enum InputType { pub fn get_input(day: u8, input: InputType) -> Result, Box> { // Find Input File Name let file_name = match input { - InputType::Test1 => format!("src/input/day{:02}_test1", day), - InputType::Test2 => format!("src/input/day{:02}_test2", day), - InputType::Actual => format!("src/input/day{:02}", day), + InputType::Test1 => format!("input/day{:02}_test1", day), + InputType::Test2 => format!("input/day{:02}_test2", day), + InputType::Actual => format!("input/day{:02}", day), }; // Read file into buffer