pub trait Solution {
// Provided methods
fn part1(&self, input: String) -> AocOption { ... }
fn part2(&self, input: String) -> AocOption { ... }
}Expand description
Defines the interface for implementing Advent of Code daily puzzle solutions. This trait must be implemented for each day’s solution, providing methods to solve both parts of the puzzle.
§Example
use advent_of_utils::{Solution, AocOption};
struct Day01 {}
impl Solution for Day01 {
fn part1(&self, input: String) -> AocOption {
// Implement solution for part 1
42.into()
}
fn part2(&self, input: String) -> AocOption {
// Implement solution for part 2
"solution".into()
}
}Provided Methods§
Sourcefn part1(&self, input: String) -> AocOption
fn part1(&self, input: String) -> AocOption
Solves Part 1 of the daily puzzle.
§Arguments
input- The puzzle input as a string, automatically fetched and cached from Advent of Code.
§Returns
AocOption- The solution result, which can be either:AocOption::Intfor numeric answersAocOption::Strfor string answersAocOption::Noneif not implemented (default)
Sourcefn part2(&self, input: String) -> AocOption
fn part2(&self, input: String) -> AocOption
Solves Part 2 of the daily puzzle.
§Arguments
input- The puzzle input as a string, automatically fetched and cached from Advent of Code.
§Returns
AocOption- The solution result, which can be either:AocOption::Intfor numeric answersAocOption::Strfor string answersAocOption::Noneif not implemented (default)