Crate adventurous
source ·Expand description
Adventurous
Adventurous is a companion crate to assist you in solving Advent of Code puzzles.
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
- Emits a test case to test the solution for part one of the puzzle.
- Emits a test case to test the solution for part two of the puzzle.
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
- Returns the Manhattan distance between two points.
- Runs the provided solvers against the puzzle input.