summaryrefslogtreecommitdiffstats
path: root/src/utils/fileutil.rs
blob: 052b72f89887c258c8cfa52375174e1e7c7d33e9 (plain)
1
2
3
4
5
6
7
8
9
10
use std::io::prelude::*;
use std::path::Path;
use std::{fs, io};

pub fn read_file_to_string(path: &Path) -> io::Result<String> {
    let mut file = fs::File::open(&path)?;
    let mut contents = String::new();
    file.read_to_string(&mut contents)?;
    Ok(contents)
}