/// Reads a file, if it exists.
Reads a file, if it exists.
Reads a file if it exists .
pub fn read_file<P: AsRef<Path>>(path: P) -> io::Result<Option<String>> {
    let result: io::Result<String> = fs::read_to_string(path);
    match result {
        Ok(string) => Ok(Some(string)),
        Err(error) => match error.kind() {
            ErrorKind::NotFound => Ok(None),
            _ => Err(error),
        },
    }
}
pub fn read_file < P : AsRef < Path > > ( path : P ) -> io :: Result < Option < String > > { let result : io :: Result < String > = fs :: read_to_string ( path ) ; match result { Ok ( string ) => Ok ( Some ( string ) ) , Err ( error ) => match error . kind ( ) { ErrorKind :: NotFound => Ok ( None ) , _ => Err ( error ) , } , } }
Reads a file, if it exists.
Reads a file if it exists .
path
P