Skip to content

SteveLauC/TreeWalker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TreeWalker

A toy replicate of walkdir

Different from walkdir, TreeWalker yields DirEntry type from the standard library. This also makes TreeWalker unusable on / since you simply can't get a DirEntry representing /.

The traversal is done is pre-order.

Why did you create this crate

I am just curious about why walkdir doesn't return the std DirEntry. To verify this, I decided to try to implement it myself. Well, I totally understand the reason right now and it makes sense to have their customized type.

Usage

use tree_walker::TreeWalker;

fn main() {
    let mut walker = TreeWalker::new("/home/steve").unwrap();

    while let Some(Ok(entry)) = walker.next() {
        println!("{:?}", entry);
    }
}

About

A toy replicate of walkdir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages