day01 both
This commit is contained in:
11
src/utils.rs
Normal file
11
src/utils.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
|
||||
pub fn read_file(path: &str) -> String {
|
||||
let mut f = File::open(path).expect(&format!("file '{}' not found", path));
|
||||
|
||||
let mut contents = String::new();
|
||||
f.read_to_string(&mut contents)
|
||||
.expect("something went wrong reading the file");
|
||||
contents
|
||||
}
|
||||
Reference in New Issue
Block a user