pub fn read_dir_eager(dir: &Path) -> io::Result<impl Iterator<Item = (DirEntry, Metadata)>> {
    let entries = read_dir(dir)?;
    let vec = entries
        .map(|entry| {
            let entry = entry?;
            let metadata = entry.metadata()?;
            Ok((entry, metadata))
        })
        .collect::<io::Result<Vec<(DirEntry, Metadata)>>>()?;

    Ok(vec.into_iter())
}
/// Reads the full contents of a directory, eagerly extracting each directory entry
/// and its metadata and returning an iterator over them. Returns `Error` if any of
/// these steps fails.
///
/// This function makes it easier to write high level logic for manipulating the
/// contents of directories (map, filter, etc).
///
/// Note that this function allocates an intermediate vector of directory entries to
/// construct the iterator from, so if a directory is expected to be very large, it
/// will allocate temporary data proportional to the number of entries.
Reads the full contents of a directory, eagerly extracting each directory entry
and its metadata and returning an iterator over them. Returns `Error` if any of
these steps fails.

This function makes it easier to write high level logic for manipulating the
contents of directories (map, filter, etc).

Note that this function allocates an intermediate vector of directory entries to
construct the iterator from, so if a directory is expected to be very large, it
will allocate temporary data proportional to the number of entries.
Reads the full contents of a directory eagerly extracting each directory entry and its metadata and returning an iterator over them . Returns ` Error ` if any of these steps fails . This function makes it easier to write high level logic for manipulating the contents of directories ( map filter etc ) . Note that this function allocates an intermediate vector of directory entries to construct the iterator from so if a directory is expected to be very large it will allocate temporary data proportional to the number of entries .
pub fn read_dir_eager(dir: &Path) -> io::Result<impl Iterator<Item = (DirEntry, Metadata)>> {
    let entries = read_dir(dir)?;
    let vec = entries
        .map(|entry| {
            let entry = entry?;
            let metadata = entry.metadata()?;
            Ok((entry, metadata))
        })
        .collect::<io::Result<Vec<(DirEntry, Metadata)>>>()?;
    Ok(vec.into_iter())
}
pub fn read_dir_eager ( dir : & Path ) -> io :: Result < impl Iterator < Item = ( DirEntry , Metadata ) > > { let entries = read_dir ( dir ) ? ; let vec = entries . map ( | entry | { let entry = entry ? ; let metadata = entry . metadata ( ) ? ; Ok ( ( entry , metadata ) ) } ) . collect :: < io :: Result < Vec < ( DirEntry , Metadata ) > > > ( ) ? ; Ok ( vec . into_iter ( ) ) }
Reads the full contents of a directory, eagerly extracting each directory entry
and its metadata and returning an iterator over them.
Reads the full contents of a directory eagerly extracting each directory entry and its metadata and returning an iterator over them .
dir
&Path
dir
&Path