From f3833dc637840fca55f253c9f362641499aa42be Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 2 Oct 2022 21:48:53 +0200 Subject: day17 --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 501b2f7..f0199c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ +use std::str::FromStr; +use std::fmt::Debug; + pub fn read_file(day: u8) -> String { let filename = format!("inputs/day{}", day); std::fs::read_to_string(filename).unwrap() @@ -8,3 +11,9 @@ pub fn read_lines(day: u8) -> Vec { .map(String::from) .collect() } + +pub fn read_numbers(day: u8) -> Vec where ::Err: Debug { + read_lines(day).iter() + .map(|n| n.parse::().unwrap()) + .collect::>() +} -- cgit v1.2.3