summaryrefslogtreecommitdiffstats
path: root/src/utils.rs
blob: 4a0337ae692c11424736893c5b9fce9a7dbfdea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
use std::fs::File;
use std::io::{Read, Result};

/// Return the string contents of a file
pub fn read_file(file_name: &str) -> Result<String> {
    let mut file = File::open(file_name)?;
    let mut data = String::new();

    file.read_to_string(&mut data)?;
    Ok(data)
}