| Crates.io | dowser |
| lib.rs | dowser |
| version | 0.17.1 |
| created_at | 2021-02-22 04:07:24.731515+00 |
| updated_at | 2025-09-21 18:24:21.325257+00 |
| description | A recursive, canonicalizing file finding library for Unix. |
| homepage | |
| repository | https://github.com/Blobfolio/dowser |
| max_upload_size | |
| id | 358783 |
| size | 64,714 |
Dowser is a(nother) fast, recursive file-finding library for Rust, but it differs from walkdir and kin in a number of ways:
It is not limited to one root; any number of file and directory paths can be loaded and traversed en masse;
Symlinks are followed by default, but can be disabled using Dowser::without_symlinks;
Hidden paths and mount points are traversed like anything else;
Matching file paths are canonicalized and deduped before yielding;
Directory paths are automatically crawled but not yielded;
Create a new instance using Dowser::default, then specify root paths to ignore and/or include with Dowser::without_path and Dowser::with_path, respectively.
From there, leverage your favorite Iterator trait methods to filter/collect the results.
use dowser::Dowser;
use std::path::PathBuf;
// Return all files under "/usr/share/man", and probably some from other places
// since some programs prefer to symlink their documentation.
let men: Vec::<PathBuf> = Dowser::default()
.with_path("/usr/share/man")
.collect();
// Same as above, but filtering paths as discovered so as to only keep the
// gzipped ones.
let men_gz: Vec::<PathBuf> = Dowser::default()
.with_path("/usr/share/man")
.filter(|p|
p.extension().is_some_and(|ext| ext.eq_ignore_ascii_case("gz"))
)
.collect();
All you need to do is chain Dowser::default with one or more of the following seed methods:
Dowser::with_path / Dowser::with_pathsDowser::without_path / Dowser::without_pathsFrom there, you can apply any Iterator methods you want.
use dowser::Dowser;
use std::path::PathBuf;
// Return all files under "/usr/share/man".
let files1: Vec::<PathBuf> = Dowser::default()
.with_path("/usr/share/man")
.collect();
// Return only Gzipped files using callback filter.
let files1: Vec::<PathBuf> = Dowser::default()
.with_path("/usr/share/man")
.filter(|p|
p.extension().is_some_and(|e| e.eq_ignore_ascii_case("gz"))
)
.collect();
Add dowser to your dependencies in Cargo.toml, like:
[dependencies]
dowser = "0.17.*"