pub trait Solution<const DAY: u8>: Solver {
type Input<'i>: RefUnwindSafe;
type Output: Display;
// Required method
fn parse(puzzle: &str) -> Self::Input<'_>;
// Provided methods
fn part_one(input: &Self::Input<'_>) -> Self::Output { ... }
fn part_two(input: &Self::Input<'_>) -> Self::Output { ... }
fn run() -> Outcome<Self::Output> { ... }
}
Expand description
Implements the solution to a single Advent of Code problem.
Should be implemented on a marker struct (e.g. struct Solutions {}
);
see the getting started guide for more information.
Required Associated Types§
Sourcetype Input<'i>: RefUnwindSafe
type Input<'i>: RefUnwindSafe
The type representing the parsed form of the puzzle input.
The generic lifetime parameter <'i>
can typically be elided; it is only
necessary if the concrete type definition contains references to the puzzle input
or other data.
Required Methods§
Provided Methods§
Sourcefn part_one(input: &Self::Input<'_>) -> Self::Output
fn part_one(input: &Self::Input<'_>) -> Self::Output
Compute the solution to part one of the problem.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.