Crate dirscent

Crate dirscent 

Source
Expand description

dirscent provides a simple and efficient iterator over the entries of a directory, and, recursively, over the entries of all subdirectories.

§Install

Add the dependency to your Cargo.toml

[dependencies]
dirscent = "0.1"

Or from the command line

% cargo add dirscent@0.1

§Example

Iterate down the directory skipping the entries for which the process does not have permissions

use dirscent::dirscent;

for it in dirscent("/usr").unwrap().skip_permission_denied() {
    match it {
        Ok(entry) => println!("{}", entry.path().display()),
        Err(err) => eprintln!("{err:?}"),
    }
}

Structs§

DirEntry
Entries returned by the iterator.
Dirscent
Iterator over the entries of a directory, and, recursively, over the entries of all subdirectories.
Error
std::io::Error with the path that caused it.

Functions§

dirscent
Creates an iterator that starts at the directory entry under the path.