advent_of_utils/
solution.rs

1use crate::AocOption;
2
3/// Defines the interface for implementing Advent of Code daily puzzle solutions.
4/// This trait must be implemented for each day's solution, providing methods
5/// to solve both parts of the puzzle.
6///
7/// # Example
8/// ```rust
9/// use advent_of_utils::{Solution, AocOption};
10///
11/// struct Day01 {}
12///
13/// impl Solution for Day01 {
14///     fn part1(&self, input: String) -> AocOption {
15///         // Implement solution for part 1
16///         42.into()
17///     }
18///
19///     fn part2(&self, input: String) -> AocOption {
20///         // Implement solution for part 2
21///         "solution".into()
22///     }
23/// }
24/// ```
25pub trait Solution {
26    /// Solves Part 1 of the daily puzzle.
27    ///
28    /// # Arguments
29    /// * `input` - The puzzle input as a string, automatically fetched and cached
30    ///             from Advent of Code.
31    ///
32    /// # Returns
33    /// * `AocOption` - The solution result, which can be either:
34    ///   - `AocOption::Int` for numeric answers
35    ///   - `AocOption::Str` for string answers
36    ///   - `AocOption::None` if not implemented (default)
37    #[allow(unused)]
38    fn part1(&self, input: String) -> AocOption {
39        AocOption::None
40    }
41
42    /// Solves Part 2 of the daily puzzle.
43    ///
44    /// # Arguments
45    /// * `input` - The puzzle input as a string, automatically fetched and cached
46    ///             from Advent of Code.
47    ///
48    /// # Returns
49    /// * `AocOption` - The solution result, which can be either:
50    ///   - `AocOption::Int` for numeric answers
51    ///   - `AocOption::Str` for string answers
52    ///   - `AocOption::None` if not implemented (default)
53    #[allow(unused)]
54    fn part2(&self, input: String) -> AocOption {
55        AocOption::None
56    }
57}