DayImplementation

Trait DayImplementation 

Source
pub trait DayImplementation {
    type Output<'a>: Display + Eq;
    type Context<'a>;

    // Required methods
    fn day(&self) -> u8;
    fn execute_part_1<'a>(
        &self,
        input: &'a str,
    ) -> Result<(Self::Output<'a>, Self::Context<'a>)>;
    fn execute_part_2<'a>(
        &self,
        input: &'a str,
        context: Self::Context<'a>,
    ) -> Result<Self::Output<'a>>;

    // Provided methods
    fn example_input(&self) -> Option<&'static str> { ... }
    fn example_part_1_result(&self) -> Option<Self::Output<'static>> { ... }
    fn example_part_2_result(&self) -> Option<Self::Output<'static>> { ... }
    fn run_with_input<'a>(
        &self,
        input: &'a str,
    ) -> Result<ExecutionResult<Self::Output<'a>>> { ... }
}

Required Associated Types§

Source

type Output<'a>: Display + Eq

Source

type Context<'a>

Required Methods§

Source

fn day(&self) -> u8

Source

fn execute_part_1<'a>( &self, input: &'a str, ) -> Result<(Self::Output<'a>, Self::Context<'a>)>

Source

fn execute_part_2<'a>( &self, input: &'a str, context: Self::Context<'a>, ) -> Result<Self::Output<'a>>

Provided Methods§

Source

fn example_input(&self) -> Option<&'static str>

Source

fn example_part_1_result(&self) -> Option<Self::Output<'static>>

Source

fn example_part_2_result(&self) -> Option<Self::Output<'static>>

Source

fn run_with_input<'a>( &self, input: &'a str, ) -> Result<ExecutionResult<Self::Output<'a>>>

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.

Implementors§