9 releases
0.4.3 | Nov 16, 2022 |
---|---|
0.4.2 | Jun 11, 2022 |
0.4.1 | Nov 19, 2021 |
0.3.0 | Nov 6, 2021 |
0.1.1 | May 27, 2020 |
#9 in #advent-of-code
36 downloads per month
7KB
77 lines
Advent of Code Rust utilities
About
This crate provides a very minimal set of utils to get started with writing Advent of Code solutions.
BufferedInput
Description
This is a wrapper over an input source (either a file or STDIN). It can be conveniently constructed by parsing cmdline arguments.
Here is an example help printout generated from a program that uses BufferedInput
:
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)
Usage
Collect all lines from input:
use std::io::BufRead;
use aoc_utils::BufferedInput;
let input = BufferedInput::parse_args("Example solution").unwrap();
let lines: Vec<String> = input.lines().map(Result::unwrap).collect();
for line in lines {
println!("{}", line);
}
Dependencies
~1MB
~17K SLoC