From 691058bd43613e48421cb211304af770122b6494 Mon Sep 17 00:00:00 2001 From: alex <> Date: Fri, 6 Dec 2024 12:59:24 +0100 Subject: [PATCH] =?utf8?q?Petite=20am=C3=A9lioration=20de=20la=20maquette?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- src/{day00.rs => template.rs} | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) rename src/{day00.rs => template.rs} (100%) diff --git a/Makefile b/Makefile index 09b3f87..6e6505d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # - update the main to integrate the new day new-day%: if [ -f "src/$(subst new-,,$@).rs" ]; then return 1; fi - cp -v src/day00.rs src/$(subst new-,,$@).rs + cp -v src/template.rs src/$(subst new-,,$@).rs sed -i \ -e "$$(( $$(grep -n main src/main.rs | cut -d ':' -f 1) - 2 ))a\pub mod $(subst new-,,$@);" \ -e "/_ =>/i\ \"$(subst new-,,$@)\" => $(subst new-,,$@)::run(\&input)?," \ diff --git a/src/day00.rs b/src/template.rs similarity index 100% rename from src/day00.rs rename to src/template.rs index f1a9a82..9bf5f24 100644 --- a/src/day00.rs +++ b/src/template.rs @@ -1,6 +1,18 @@ use std::error::Error; use std::path::Path; +fn run_part1(input: &str) -> Result> { + println!("Running {} - part 1", get_day()); + + Ok(0) +} + +fn run_part2(input: &str) -> Result> { + println!("Running {} - part 2", get_day()); + + Ok(0) +} + pub fn run(input: &str) -> Result<(), Box> { let res = run_part1(&input)?; println!("{res}"); @@ -16,18 +28,6 @@ fn get_day() -> String { Path::new(filename).file_stem().unwrap().to_str().unwrap().to_string() } -fn run_part1(input: &str) -> Result> { - println!("Running {} - part 1", get_day()); - - Ok(0) -} - -fn run_part2(input: &str) -> Result> { - println!("Running {} - part 2", get_day()); - - Ok(0) -} - #[cfg(test)] mod tests { use super::*; -- 2.39.5