Cleaned up AoC libs and main runner

This commit is contained in:
Luke Else 2023-12-01 16:13:54 +00:00
parent acb8170222
commit 5a677ea222
5 changed files with 13 additions and 13 deletions

View File

@ -3,7 +3,7 @@ mod solutions;
use std::error::Error;
use solutions::{dayxx::Solution, *};
use solutions::*;
use crate::utils::get_input;
@ -14,7 +14,8 @@ fn main() -> Result<(), Box<dyn Error>>{
Box::new(day02::Day02{})
];
for day in days {
// Run through and generate solutions
for day in days.iter().rev() {
println!("Day{} Part1 Test: {}", day.get_day(), day.part1(get_input(day.get_day(), utils::InputType::Test1)?.as_mut())?);
println!("Day{} Part1 Result: {}", day.get_day(), day.part1(get_input(day.get_day(), utils::InputType::Actual)?.as_mut())?);

View File

@ -1,4 +1,4 @@
use super::dayxx::Solution;
use super::Solution;
use std::str::FromStr;
use fancy_regex::Regex;
use strum_macros::EnumString;

View File

@ -1,4 +1,4 @@
use super::dayxx::Solution;
use super::Solution;
pub struct Day02 {}

View File

@ -1,7 +0,0 @@
use std::{error::Error, fmt::Display};
pub trait Solution {
fn part1(&self, input: &mut Vec<String>) -> Result<Box<dyn Display>, Box<dyn Error>>;
fn part2(&self, input: &mut Vec<String>) -> Result<Box<dyn Display>, Box<dyn Error>>;
fn get_day(&self) -> u8;
}

View File

@ -1,4 +1,10 @@
pub mod dayxx;
pub mod day01;
pub mod day02;
use std::{error::Error, fmt::Display};
pub trait Solution {
fn part1(&self, input: &mut Vec<String>) -> Result<Box<dyn Display>, Box<dyn Error>>;
fn part2(&self, input: &mut Vec<String>) -> Result<Box<dyn Display>, Box<dyn Error>>;
fn get_day(&self) -> u8;
}