// one possible implementation of walking a directory only visiting files
//(from the rust docs)
one possible implementation of walking a directory only visiting files
(from the rust docs)
one possible implementation of walking a directory only visiting files ( from the rust docs )
fn visit_dirs(dir: &Path, cb: &mut FnMut(&DirEntry)) -> io::Result<()> {
    if dir.is_dir() {
        for entry in fs::read_dir(dir)? {
            let entry = entry?;
            let path = entry.path();
            if path.is_dir() {
                visit_dirs(&path, cb)?;
            } else {
                cb(&entry);
            }
        }
    }
    Ok(())
}
fn visit_dirs ( dir : & Path , cb : & mut FnMut ( & DirEntry ) ) -> io :: Result < ( ) > { if dir . is_dir ( ) { for entry in fs :: read_dir ( dir ) ? { let entry = entry ? ; let path = entry . path ( ) ; if path . is_dir ( ) { visit_dirs ( & path , cb ) ? ; } else { cb ( & entry ) ; } } } Ok ( ( ) ) }
one possible implementation of walking a directory only visiting files
(from the rust docs)
one possible implementation of walking a directory only visiting files ( from the rust docs )
dir
&Path
cb
&mut FnMut(&DirEntry)