Crate adventurous

source ·
Expand description

Adventurous

Adventurous is a companion crate to assist you in solving Advent of Code puzzles.

crates.io docs.rs license

Installation

[dependencies]
adventurous = "0.2.0"

Examples

Solving a puzzle

use adventurous::Input;
use anyhow::Result;

fn part_one(input: &Input) -> Result<usize> {
    Ok(input
        .lines()
        .map(|line| {
            // Do something with the line...
            line.parse::<usize>()
        })
        .collect::<Result<Vec<_>, _>>()?
        .into_iter()
        .sum())
}

fn part_two(_input: &Input) -> Result<usize> {
    todo!()
}

fn main() -> Result<()> {
    adventurous::run("input.txt", part_one, part_two)
}

Modules

Macros

Structs

  • The input for an Advent of Code puzzle.

Traits

  • A trait for counting the number of occurrences of each character in a string.
  • A trait for solving an Advent of Code puzzle.

Functions