Files
aoc_2018/src/utils.rs
2018-12-01 10:03:12 +01:00

12 lines
314 B
Rust

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
}