1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*!
# Dowser
[](https://docs.rs/dowser/)
[](https://github.com/Blobfolio/dowser/blob/master/CHANGELOG.md)<br>
[](https://crates.io/crates/dowser)
[](https://github.com/Blobfolio/dowser/actions)
[](https://deps.rs/crate/dowser/)<br>
[](https://en.wikipedia.org/wiki/WTFPL)
[](https://github.com/Blobfolio/dowser/issues)
[`Dowser`] is a(nother) fast, recursive file-finding library for Rust, but it differs from [`walkdir`](https://crates.io/crates/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;
## Example
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`](std::iter::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();
# assert!(men.len() >= men_gz.len(), "There are more filtered than unfiltered results?!");
```
*/
pub use Extension;
pub use Dowser;