refactor: rename main! macro to solution!
This commit is contained in:
@@ -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::*;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user