pub fn read(file_path: &str) -> HashMap<String, Vec<String>> {
        match File::open(file_path) {
            Ok(file) => serde_yaml::from_reader(&file)
                .map_err(|err| {
                    warn!("Failed to recover previous results: {}", err);
                })
                .unwrap_or_default(),
            Err(err) => match err.kind() {
                ErrorKind::NotFound => {
                    // Check that we can write to this file
                    File::create(file_path).unwrap_or_else(|err| {
                        eprintln!(
                            "Error: Unable to create --results-file {}: {}",
                            file_path, err
                        );
                        exit(1);
                    });
                    HashMap::new()
                }
                err => {
                    eprintln!(
                        "Error: Unable to open --results-file {}: {:?}",
                        file_path, err
                    );
                    exit(1);
                }
            },
        }
    }
// Reads the previous results file and if it exists, parses the contents
Reads the previous results file and if it exists, parses the contents
Reads the previous results file and if it exists parses the contents
pub fn read(file_path: &str) -> HashMap<String, Vec<String>> {
        match File::open(file_path) {
            Ok(file) => serde_yaml::from_reader(&file)
                .map_err(|err| {
                    warn!("Failed to recover previous results: {}", err);
                })
                .unwrap_or_default(),
            Err(err) => match err.kind() {
                ErrorKind::NotFound => {
                    // Check that we can write to this file
                    File::create(file_path).unwrap_or_else(|err| {
                        eprintln!(
                            "Error: Unable to create --results-file {}: {}",
                            file_path, err
                        );
                        exit(1);
                    });
                    HashMap::new()
                }
                err => {
                    eprintln!(
                        "Error: Unable to open --results-file {}: {:?}",
                        file_path, err
                    );
                    exit(1);
                }
            },
        }
    }
pub fn read ( file_path : & str ) -> HashMap < String , Vec < String > > { match File :: open ( file_path ) { Ok ( file ) => serde_yaml :: from_reader ( & file ) . map_err ( | err | { warn ! ( " " err ) ; } ) . unwrap_or_default ( ) , Err ( err ) => match err . kind ( ) { ErrorKind :: NotFound => { // Check that we can write to this file File :: create ( file_path ) . unwrap_or_else ( | err | { eprintln ! ( " " file_path err ) ; exit ( 1 ) ; } ) ; HashMap :: new ( ) } err => { eprintln ! ( " " file_path err ) ; exit ( 1 ) ; } } , } }
Reads the previous results file and if it exists, parses the contents
Reads the previous results file and if it exists parses the contents
file_path
&str