[][src]Struct aoc_helper::Puzzle

pub struct Puzzle<T, D> { /* fields omitted */ }

The Puzzle struct stores information for an aoc puzzle. Two puzzles release each aoc day.

Methods

impl<T, D: Display> Puzzle<T, D>[src]

pub fn new(part: u8, solver: fn(_: T) -> D) -> Self[src]

Create a new Puzzle instance for the provided part number and solver function.

Example

use aoc_helper::Puzzle;

let part_1 = Puzzle::new(1, |x| x.lines().count());

pub fn examples<S: ToString>(&mut self, examples: &[S])[src]

Provide some example inputs for a Puzzle instance that the solver function will be given when AocDay::test() is called.

Example

use aoc_helper::Puzzle;

let mut part_2 = Puzzle::new(2, |x| x.lines().nth(0).unwrap());
part_2.examples(&["example\ninput", "foo\nbar"]);

pub fn with_examples<S: ToString>(self, examples: &[S]) -> Self[src]

Chainable version of Puzzle::examples()

Example

use aoc_helper::Puzzle;

let part_2 = Puzzle::new(2, |x| lines().nth(0).unwrap())
    .with_examples(&["example\ninput", "foo\nbar"]);

Auto Trait Implementations

impl<T, D> RefUnwindSafe for Puzzle<T, D>

impl<T, D> Send for Puzzle<T, D>

impl<T, D> Sync for Puzzle<T, D>

impl<T, D> Unpin for Puzzle<T, D>

impl<T, D> UnwindSafe for Puzzle<T, D>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.