use std::{path::Path, io::{BufReader, BufRead, self}, fs::File}; #[derive(Debug)] pub struct AdventError(String); impl From for AdventError { fn from(e: io::Error) -> Self { AdventError(e.to_string()) } } pub fn read_into_vec(path: &Path) -> Result, AdventError> { let file = File::open(path).expect("no such file"); let buf = BufReader::new(file); buf.lines().map(|line| line.map_err(Into::into)).collect::, AdventError>>() }