pub fn make_vec_from_filenames(filenames: &[PathBuf]) -> Vec<String> {
    let mut word_list: Vec<String> = [].to_vec();
    for filename in filenames {
        let f = match File::open(filename) {
            Ok(file) => file,
            Err(e) => panic!("Error opening file {:?}: {}", filename, e),
        };
        let file = BufReader::new(&f);
        for line in file.lines() {
            let l = match line {
                Ok(l) => l,
                Err(e) => {
                    eprintln!(
                        "Error reading a line from file {:?}: {}\nWill continue reading file.",
                        filename, e
                    );
                    continue;
                }
            };
            word_list.push(l);
        }
    }
    word_list
}
/// Takes a slice of `PathBuf`s representing the word list(s)
/// that the user has inputted to the program. Then iterates
/// through each file and addes each line to Vec<String>. (Blank
/// lines and duplicate links will be handled elsewhere.)
Takes a slice of `PathBuf`s representing the word list(s)
that the user has inputted to the program. Then iterates
through each file and addes each line to Vec. (Blank
lines and duplicate links will be handled elsewhere.)
Takes a slice of ` PathBuf ` s representing the word list ( s ) that the user has inputted to the program . Then iterates through each file and addes each line to Vec . ( Blank lines and duplicate links will be handled elsewhere . )
pub fn make_vec_from_filenames(filenames: &[PathBuf]) -> Vec<String> {
    let mut word_list: Vec<String> = [].to_vec();
    for filename in filenames {
        let f = match File::open(filename) {
            Ok(file) => file,
            Err(e) => panic!("Error opening file {:?}: {}", filename, e),
        };
        let file = BufReader::new(&f);
        for line in file.lines() {
            let l = match line {
                Ok(l) => l,
                Err(e) => {
                    eprintln!(
                        "Error reading a line from file {:?}: {}\nWill continue reading file.",
                        filename, e
                    );
                    continue;
                }
            };
            word_list.push(l);
        }
    }
    word_list
}
pub fn make_vec_from_filenames ( filenames : & [ PathBuf ] ) -> Vec < String > { let mut word_list : Vec < String > = [ ] . to_vec ( ) ; for filename in filenames { let f = match File :: open ( filename ) { Ok ( file ) => file , Err ( e ) => panic ! ( " " filename e ) , } ; let file = BufReader :: new ( & f ) ; for line in file . lines ( ) { let l = match line { Ok ( l ) => l , Err ( e ) => { eprintln ! ( " \n " filename e ) ; continue ; } } ; word_list . push ( l ) ; } } word_list }
Takes a slice of `PathBuf`s representing the word list(s)
that the user has inputted to the program.
Takes a slice of ` PathBuf ` s representing the word list ( s ) that the user has inputted to the program .
filenames
&[PathBuf]
filenames
&[PathBuf]