Cleaned up AoC libs and main runner
This commit is contained in:
parent
acb8170222
commit
5a677ea222
@ -3,7 +3,7 @@ mod solutions;
|
|||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
use solutions::{dayxx::Solution, *};
|
use solutions::*;
|
||||||
|
|
||||||
use crate::utils::get_input;
|
use crate::utils::get_input;
|
||||||
|
|
||||||
@ -14,7 +14,8 @@ fn main() -> Result<(), Box<dyn Error>>{
|
|||||||
Box::new(day02::Day02{})
|
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 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())?);
|
println!("Day{} Part1 Result: {}", day.get_day(), day.part1(get_input(day.get_day(), utils::InputType::Actual)?.as_mut())?);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use super::dayxx::Solution;
|
use super::Solution;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use fancy_regex::Regex;
|
use fancy_regex::Regex;
|
||||||
use strum_macros::EnumString;
|
use strum_macros::EnumString;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use super::dayxx::Solution;
|
use super::Solution;
|
||||||
|
|
||||||
pub struct Day02 {}
|
pub struct Day02 {}
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -1,4 +1,10 @@
|
|||||||
pub mod dayxx;
|
|
||||||
|
|
||||||
pub mod day01;
|
pub mod day01;
|
||||||
pub mod day02;
|
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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user