refactor: rename main! macro to solution!

This commit is contained in:
Felix Spöttel 2023-11-22 14:13:12 +01:00
parent 6d9bf346a0
commit a3cc3a7efe
2 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,9 @@ use std::{
use crate::Day; use crate::Day;
const MODULE_TEMPLATE: &str = r#"pub fn part_one(input: &str) -> Option<u32> { const MODULE_TEMPLATE: &str = r#"advent_of_code::solution!(DAY_NUMBER);
pub fn part_one(input: &str) -> Option<u32> {
None None
} }
@ -14,8 +16,6 @@ pub fn part_two(input: &str) -> Option<u32> {
None None
} }
advent_of_code::main!(DAY_NUMBER);
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -19,9 +19,9 @@ pub fn read_file(folder: &str, day: Day) -> String {
f.expect("could not open input file") f.expect("could not open input file")
} }
/// main! produces a block setting up the input and runner for each part. /// Creates the constant `DAY` and sets up the input and runner for each part.
#[macro_export] #[macro_export]
macro_rules! main { macro_rules! solution {
($day:expr) => { ($day:expr) => {
/// The current day. /// The current day.
const DAY: advent_of_code::Day = advent_of_code::day!($day); const DAY: advent_of_code::Day = advent_of_code::day!($day);