Made everything a bit more rustic
This commit is contained in:
parent
7f5b6e03f9
commit
a5f19ecae1
22 changed files with 376 additions and 274 deletions
|
|
@ -3,7 +3,7 @@ mod days;
|
|||
mod macros;
|
||||
|
||||
use anyhow::Result;
|
||||
use common::file::read_lines;
|
||||
use common::file::read_string;
|
||||
use days::{day_provider, DayTrait, ResultType};
|
||||
use std::{
|
||||
env,
|
||||
|
|
@ -47,7 +47,7 @@ fn output(day: usize, part: usize, result: ResultType, time: Duration) {
|
|||
}
|
||||
}
|
||||
|
||||
fn run_part(day: &dyn DayTrait, is_part1: bool, lines: &[String]) -> Result<Duration> {
|
||||
fn run_part(day: &dyn DayTrait, is_part1: bool, lines: &str) -> Result<Duration> {
|
||||
let now = Instant::now();
|
||||
let result = if is_part1 {
|
||||
day.part1(lines)?
|
||||
|
|
@ -70,7 +70,7 @@ fn run_part(day: &dyn DayTrait, is_part1: bool, lines: &[String]) -> Result<Dura
|
|||
}
|
||||
|
||||
fn run(day: &dyn DayTrait, part1: bool, part2: bool) -> Result<Duration> {
|
||||
let lines = read_lines(day.get_day_number(), "input.txt")?;
|
||||
let lines = read_string(day.get_day_number(), "input.txt")?;
|
||||
let elapsed1 = if part1 {
|
||||
run_part(day, true, &lines)?
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue