file_utils.rs
1 use std::{path::PathBuf,fs::File,io::Read}; 2 pub fn get_file_content(path:PathBuf) -> String { 3 match File::open(&path) { 4 Ok(mut file) => { 5 let mut buf : String = "".to_string(); 6 Read::read_to_string(&mut file, &mut buf).unwrap(); 7 buf 8 } 9 Err(msg) => panic!("{} : {}", path.display(), msg) 10 } 11 }