1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-29 13:03:28 +00:00
starship/src/utils.rs

12 lines
274 B
Rust
Raw Normal View History

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)
}