/// Loads the TAL files from the given directory.
Loads the TAL files from the given directory.
Loads the TAL files from the given directory .
fn load_tals(tal_dir: &Path) -> Result<Vec<Tal>, Error> {
        let mut res = Vec::new();
        let dir = match fs::read_dir(tal_dir) {
            Ok(dir) => dir,
            Err(err) => {
                eprintln!("Failed to open TAL directory: {}", err);
                return Err(Error)
            }
        };
        for entry in dir {
            let entry = match entry {
                Ok(entry) => entry,
                Err(err) => {
                    eprintln!(
                        "Failed to iterate over tal directory: {}",
                        err
                    );
                    return Err(Error)
                }
            };
            let path = entry.path();
            if !entry.file_type().map(|ft| ft.is_file()).unwrap_or(false) {
                eprintln!("{}: garbage in TAL directory.", path.display());
                continue
            }
            let mut file = match File::open(&path) {
                Ok(file) => {
                    file
                }
                Err(err) => {
                    eprintln!(
                        "Failed to open TAL {}: {}. \n\
                         Aborting.",
                         path.display(), err
                    );
                    return Err(Error)
                }
            };
            let tal = match Tal::read(&path, &mut file) {
                Ok(tal) => tal,
                Err(err) => {
                    eprintln!(
                        "Failed to read TAL {}: {}. \n\
                         Aborting.",
                        path.display(), err
                    );
                    return Err(Error)
                }
            };
            res.push(tal);
        }
        Ok(res)
    }
fn load_tals ( tal_dir : & Path ) -> Result < Vec < Tal > , Error > { let mut res = Vec :: new ( ) ; let dir = match fs :: read_dir ( tal_dir ) { Ok ( dir ) => dir , Err ( err ) => { eprintln ! ( " " err ) ; return Err ( Error ) } } ; for entry in dir { let entry = match entry { Ok ( entry ) => entry , Err ( err ) => { eprintln ! ( " " err ) ; return Err ( Error ) } } ; let path = entry . path ( ) ; if ! entry . file_type ( ) . map ( | ft | ft . is_file ( ) ) . unwrap_or ( false ) { eprintln ! ( " " path display ( ) ) ; continue } let mut file = match File :: open ( & path ) { Ok ( file ) => { file } Err ( err ) => { eprintln ! ( " \n \
 " path display ( ) err ) ; return Err ( Error ) } } ; let tal = match Tal :: read ( & path , & mut file ) { Ok ( tal ) => tal , Err ( err ) => { eprintln ! ( " \n \
 " path display ( ) err ) ; return Err ( Error ) } } ; res . push ( tal ) ; } Ok ( res ) }
Loads the TAL files from the given directory.
Loads the TAL files from the given directory .
tal_dir
&Path