aocsol 0.1.1

Crate to generate solver for AOC puzzle.
Documentation
//! Holds the traits for puzzle and solver.

use async_trait::async_trait;
use std::fmt::Display;

/// Trait to be implemented by a puzzle.
pub trait Puzzl: Send + Sync {
    /// Dataset type. e.g. [`String`](String), [`&str`](&str), [`Vec<u8>`](Vec<u8>), etc.
    type InputType;

    /// Method to get the year of the puzzle.
    fn year(&self) -> u32;

    /// Method to get the day of the puzzle. Should return a [`u32`](u32) between 1 and 25.
    fn day(&self) -> u32;

    /// Method to get the dataset associated with the puzzle.
    fn data(&self) -> Self::InputType;
}

/// Trait to be implemented by a solver. Consider using [`mod@async_trait`] macro to implement this
/// trait.
#[async_trait]
pub trait Solve: Send + Sync {
    type PartOne: Display + Send + Sync;

    type PartTwo: Display + Send + Sync;

    /// Method to get answer to the part one of the puzzle.
    async fn part_one(&self) -> Result<Self::PartOne, Box<dyn std::error::Error + Send + Sync>>;

    /// Method to get answer to the part two of the puzzle.
    async fn part_two(&self) -> Result<Self::PartTwo, Box<dyn std::error::Error + Send + Sync>>;
}