pub fn visit_dirs(dir: &Path, cb: &mut FnMut(DirEntry)) -> io::Result<()> {
    let meta = try!(metadata(dir));
    // if dir.is_dir() {
    if meta.is_dir() {
        for entry in try!(fs::read_dir(dir)) {
            let entry = try!(entry);
            let meta = try!(metadata(entry.path()));
            //if entry.path().is_dir() {
            if meta.is_dir() {
                try!(visit_dirs(&entry.path(), cb));
            } else {
                cb(entry);
            }
        }
    }
    Ok(())
}
// one possible implementation of fs::walk_dir only visiting files
one possible implementation of fs::walk_dir only visiting files
one possible implementation of fs :: walk_dir only visiting files
pub fn visit_dirs(dir: &Path, cb: &mut FnMut(DirEntry)) -> io::Result<()> {
    let meta = try!(metadata(dir));
    // if dir.is_dir() {
    if meta.is_dir() {
        for entry in try!(fs::read_dir(dir)) {
            let entry = try!(entry);
            let meta = try!(metadata(entry.path()));
            //if entry.path().is_dir() {
            if meta.is_dir() {
                try!(visit_dirs(&entry.path(), cb));
            } else {
                cb(entry);
            }
        }
    }
    Ok(())
}
pub fn visit_dirs ( dir : & Path , cb : & mut FnMut ( DirEntry ) ) -> io :: Result < ( ) > { let meta = try ! ( metadata ( dir ) ) ; // if dir.is_dir() { if meta . is_dir ( ) { for entry in try ! ( fs read_dir ( dir ) ) { let entry = try ! ( entry ) ; let meta = try ! ( metadata ( entry path ( ) ) ) ; //if entry.path().is_dir() { if meta . is_dir ( ) { try ! ( visit_dirs ( entry path ( ) cb ) ) ; } else { cb ( entry ) ; } } } Ok ( ( ) ) }
one possible implementation of fs::walk_dir only visiting files
one possible implementation of fs :: walk_dir only visiting files
dir
&Path
cb
&mut FnMut(DirEntry)