Skip to main content

weavatrix_scan/config/
walk.rs

1use super::ScanOptions;
2use crate::walk_types::{ErrorPolicy, RootSymlinkPolicy};
3
4impl ScanOptions {
5    #[must_use]
6    pub const fn with_max_depth(mut self, max_depth: Option<usize>) -> Self {
7        self.walk.max_depth = max_depth;
8        self
9    }
10
11    #[must_use]
12    pub const fn with_min_depth(mut self, min_depth: usize) -> Self {
13        self.walk.min_depth = min_depth;
14        self
15    }
16
17    #[must_use]
18    pub const fn with_max_open(mut self, max_open: usize) -> Self {
19        self.walk.max_open = if max_open == 0 { 1 } else { max_open };
20        self
21    }
22
23    #[must_use]
24    pub const fn with_same_file_system(mut self, enabled: bool) -> Self {
25        self.walk.same_file_system = enabled;
26        self
27    }
28
29    #[must_use]
30    pub const fn with_follow_links(mut self, enabled: bool) -> Self {
31        self.walk.follow_links = enabled;
32        self
33    }
34
35    #[must_use]
36    pub const fn with_error_policy(mut self, policy: ErrorPolicy) -> Self {
37        self.walk.error_policy = policy;
38        self
39    }
40
41    #[must_use]
42    pub const fn with_root_symlink_policy(mut self, policy: RootSymlinkPolicy) -> Self {
43        self.walk.root_symlink_policy = policy;
44        self
45    }
46}