forked from MightyPork/crsn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
317 B
14 lines
317 B
use std::fs::File;
|
|
use std::io;
|
|
use std::io::Read;
|
|
use std::path::Path;
|
|
|
|
/// Read a file to string
|
|
pub fn read_file<P: AsRef<Path>>(path: P) -> io::Result<String> {
|
|
let path = path.as_ref();
|
|
let mut file = File::open(path)?;
|
|
|
|
let mut buf = String::new();
|
|
file.read_to_string(&mut buf)?;
|
|
Ok(buf)
|
|
}
|
|
|