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

35 lines
604 B
Rust

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);
}