12 lines
314 B
Rust
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
|
|
}
|