fn read_file(file_path: &String, words: &mut Vec<String>) -> Result<bool, String> {
    let file_string_result = fs::read_to_string(file_path);
    if file_string_result.is_err() {
        return Err("Failed to read in file".to_string());
    }
    // parse the string into a vector new line delimeted
    for word in file_string_result.unwrap().split("\n") {
        words.push(word.to_string())
    }
    Ok(true)
}
/// Read in a file, given a full file path
/// #Params
/// file_path: &String, representing the path to the input file.
/// words: &mut Vec<String>, dictionary of words to have file data written to.
/// # Returns
/// Result<bool, String>, result of the operation, bool is always true; result is an error string.
Read in a file, given a full file path
Read in a file given a full file path
fn read_file(file_path: &String, words: &mut Vec<String>) -> Result<bool, String> {
    let file_string_result = fs::read_to_string(file_path);
    if file_string_result.is_err() {
        return Err("Failed to read in file".to_string());
    }
    // parse the string into a vector new line delimeted
    for word in file_string_result.unwrap().split("\n") {
        words.push(word.to_string())
    }
    Ok(true)
}
fn read_file ( file_path : & String , words : & mut Vec < String > ) -> Result < bool , String > { let file_string_result = fs :: read_to_string ( file_path ) ; if file_string_result . is_err ( ) { return Err ( " " . to_string ( ) ) ; } // parse the string into a vector new line delimeted for word in file_string_result . unwrap ( ) . split ( " \n " ) { words . push ( word . to_string ( ) ) } Ok ( true ) }
Read in a file, given a full file path
Read in a file given a full file path
file_path
&String
words
&mut Vec<String>
Result, result of the operation, bool is always true; result is an error string.
Result result of the operation bool is always true ; result is an error string .
file_path
&String
words
&mut Vec<String>
params
&String, representing the path to the input file.
words: &mut Vec, dictionary of words to have file data written to.
&String representing the path to the input file . words : &mut Vec dictionary of words to have file data written to .