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
//! Recursion policy for [`crate::Swdir`].
//!
//! In 0.9 this was a two-field struct (`enabled` + `depth_limit`) which
//! allowed the nonsensical combination `enabled = false, depth_limit = Some(..)`
//! and made reading call sites hard. In 0.10 it is an enum that can only
//! express the three meaningful states:
//!
//! * [`Recurse::None`] — don't descend at all (root dir only)
//! * [`Recurse::Unlimited`] — descend the whole tree
//! * [`Recurse::Depth(n)`] — descend at most `n` levels below the root
//!
//! For further refinement by *filter* (rather than by the traversal policy
//! itself), see [`crate::FilterRule::MaxDepth`].
/// Recursion policy controlling how deeply [`crate::Swdir::walk`] descends.
///
/// Depth is counted from the scan root. `Depth(0)` behaves the same as
/// [`Recurse::None`]: root-level entries are listed but no subdirectory is
/// entered. `Depth(1)` enters the root's immediate child directories but no
/// further, and so on.