Skip to content

Commit

Permalink
refactor: rename main! macro to solution!
Browse files Browse the repository at this point in the history
  • Loading branch information
fspoettel committed Nov 22, 2023
1 parent 6d9bf34 commit a3cc3a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/template/commands/scaffold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ use std::{

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
}
pub fn part_two(input: &str) -> Option<u32> {
None
}
advent_of_code::main!(DAY_NUMBER);
#[cfg(test)]
mod tests {
use super::*;
Expand Down
4 changes: 2 additions & 2 deletions src/template/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ pub fn read_file(folder: &str, day: Day) -> String {
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_rules! main {
macro_rules! solution {
($day:expr) => {
/// The current day.
const DAY: advent_of_code::Day = advent_of_code::day!($day);
Expand Down

0 comments on commit a3cc3a7

Please sign in to comment.