Closed
Description
First of all, thank you for an amazing starter template. This repo makes it so easy to try out Rust for advent of code!
In AOC 2023 the first day puzzle has two example inputs, one for each part. The default read_file function only accepts a day which is strongly typed so you can only ever read 01.txt
, etc.
In my project I just added a new function that takes a part number too:
pub fn read_file_part(folder: &str, day: Day, part: u8) -> String {
let cwd = env::current_dir().unwrap();
let filepath = cwd.join("data").join(folder).join(format!("{day}-{part}.txt"));
let f = fs::read_to_string(filepath);
f.expect("could not open input file")
}
Metadata
Metadata
Assignees
Labels
No labels