Struct fts::walkdir::WalkDir [] [src]

pub struct WalkDir {
    // some fields omitted
}

A builder to create an iterator for directory walking.

Examples

The simplest usage is the following.

let path = Path::new( "test" );
for p in WalkDir::new( WalkDirConf::new( path ) ) {
    println!( "{:?}", p.unwrap() );
}

WalkDirConf is a configuration builder of directory walking. For example, if you want to follow symblic links, you can use follow_symlink() like the following.

let path = Path::new( "test" );
for p in WalkDir::new( WalkDirConf::new( path ).follow_symlink() ) {
    println!( "{:?}", p.unwrap() );
}

If you want to use metadata of files, you can use no_metadata() for performance optimization like the following.

let path = Path::new( "test" );
for p in WalkDir::new( WalkDirConf::new( path ).no_metadata() ) {
    println!( "{:?}", p.unwrap() );
}

Methods

impl WalkDir
[src]

fn new(conf: WalkDirConf) -> Self

Create new WalkDir configured by specified WalkDirConf.

fn path(&self) -> &str

Return the base directory for directory walking.

Test whether WalkDir follows symblic links.

fn is_cross_device(&self) -> bool

Test whether WalkDir follows symblic links across devices.

fn is_include_dot(&self) -> bool

Test whether WalkDir enumerates . and ...

fn is_no_metadata(&self) -> bool

Test whether WalkDir provides metadata.

fn is_no_chdir(&self) -> bool

Test whether WalkDir change current directory through directory walking.

Trait Implementations

impl IntoIterator for WalkDir
[src]

type Item = Result<DirEntryError>

The type of the elements being iterated over.

type IntoIter = Iter

Which kind of iterator are we turning this into?

fn into_iter(self) -> Iter

Creates an iterator from a value. Read more