solution: allow running sample as binary
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
1b3394fd94
commit
9ff562eef9
1 changed files with 9 additions and 2 deletions
|
@ -19,7 +19,7 @@ pub trait Solution<Input, Output: Display> {
|
|||
fn part_1(input: &Input) -> Output;
|
||||
fn part_2(input: &Input) -> Output;
|
||||
|
||||
fn main() -> Result<()>
|
||||
fn run(type_of_input: &str) -> Result<()>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
|
@ -33,13 +33,20 @@ pub trait Solution<Input, Output: Display> {
|
|||
.init();
|
||||
color_eyre::install()?;
|
||||
|
||||
let input = Self::parse_input(format!("inputs/{}.txt", Self::day()));
|
||||
let input = Self::parse_input(format!("{}s/{}.txt", type_of_input, Self::day()));
|
||||
|
||||
info!("Part 1: {}", Self::part_1(&input));
|
||||
info!("Part 2: {}", Self::part_2(&input));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() -> Result<()>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
Self::run("input")
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
|
|
Loading…
Reference in a new issue