Crates.io | dirscent |
lib.rs | dirscent |
version | 0.1.0 |
source | src |
created_at | 2024-03-23 19:23:17.305502 |
updated_at | 2024-03-23 19:23:17.305502 |
description | Directory descent |
homepage | |
repository | https://codeberg.org/xmyst/dirscent.git |
max_upload_size | |
id | 1183752 |
size | 48,861 |
dirscent
provides a simple and efficient iterator over the entries of
a directory, and, recursively, over the entries of all subdirectories.
Add the dependency to your Cargo.toml
[dependencies]
dirscent = "0.1"
Or from the command line
% cargo add dirscent@0.1
Iterate down the hierarchy skipping the entries for which the process does not have permissions
use dirscent::dirscent;
fn main() {
for it in dirscent("/usr")
.unwrap()
.postorder()
.skip_permission_denied()
{
match it {
Ok(entry) => println!("{}", entry.path().display()),
Err(err) => eprintln!("{err:?}"),
}
}
}
On my system, dirscent
is 1.5× faster than fts(3)
and 2× faster than
find(1)
. Run benches/b.sh
and see for yourself.