advent-of-code/2022/rust/day03.rs

35 lines
604 B
Rust
Raw Permalink Normal View History

2022-12-09 16:43:00 +00:00
use std::collections::HashMap;
use std::{
fs::File,
io::{prelude::*, BufReader},
path::Path,
};
fn lines_from_file(filename: impl AsRef<Path>) -> Vec<String> {
let file = File::open(filename).expect("no such file");
let buf = BufReader::new(file);
buf.lines()
.map(|l| l.expect("Could not parse line"))
.collect()
}
// ---
fn main() {
let lines = lines_from_file("../full/day02.txt");
part1(&lines);
part2(&lines);
}
fn part1(lines: &Vec<String>) {
println!("{:?}", lines);
}
fn part2(lines: &Vec<String>) {
println!("{:?}", lines);
}