vast/util/
file.rs

1use std::fs::File;
2use std::io::prelude::*;
3use std::path::Path;
4
5pub fn read_to_string<P: AsRef<Path>>(path: P) -> String {
6    let mut file = File::open(path).expect("Error: openning the file");
7    let mut contents = String::new();
8    file.read_to_string(&mut contents)
9        .expect("Error: reading the file");
10    contents
11}