Crates.io | aoc-utils |
lib.rs | aoc-utils |
version | 0.5.0 |
source | src |
created_at | 2020-05-25 17:07:03.463858 |
updated_at | 2023-09-17 12:54:29.19274 |
description | A minimal set of utils for writing Advent of Code solutions |
homepage | |
repository | https://github.com/tranzystorek-io/aoc-utils |
max_upload_size | |
id | 245648 |
size | 8,698 |
This crate provides a very minimal set of utils to get started with writing Advent of Code solutions.
AocCommand
This is a CLI command builder that provides an input source (either a file or STDIN). The suggested workflow is to create a Rust project with one binary per AOC solution.
Here is an example help printout generated from a program generated by AocCommand
:
Example description
USAGE:
prog [FILE]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
ARGS:
<FILE> Input file (defaults to STDIN if not provided)
Collect all lines from input:
use std::io::BufRead;
use aoc_utils::AocCommand;
let input = AocCommand::new("Example solution").parse_args().unwrap();
let lines: Vec<String> = input.lines().map(Result::unwrap).collect();
for line in lines {
println!("{}", line);
}