Skip to main content

clean_dev_dirs/config/
scan.rs

1//! Scanning configuration for directory traversal.
2//!
3//! This module defines the options that control how directories are scanned
4//! and what information is collected during the scanning process.
5
6use std::path::PathBuf;
7
8/// Configuration for directory scanning behavior.
9///
10/// This struct contains options that control how directories are traversed
11/// and what information is collected during the scanning process.
12#[derive(Clone, Debug)]
13pub struct ScanOptions {
14    /// Whether to show verbose output including scan errors
15    pub verbose: bool,
16
17    /// Number of threads to use for scanning (0 = default)
18    pub threads: usize,
19
20    /// List of directory patterns to skip during scanning
21    pub skip: Vec<PathBuf>,
22
23    /// Maximum directory depth to scan (None = unlimited)
24    pub max_depth: Option<usize>,
25}
26
27#[cfg(test)]
28mod tests {
29    use super::*;
30
31    #[test]
32    fn test_scan_options_creation() {
33        let scan_opts = ScanOptions {
34            verbose: true,
35            threads: 4,
36            skip: vec![PathBuf::from("test")],
37            max_depth: None,
38        };
39
40        assert!(scan_opts.verbose);
41        assert_eq!(scan_opts.threads, 4);
42        assert_eq!(scan_opts.skip.len(), 1);
43    }
44
45    #[test]
46    fn test_scan_options_clone() {
47        let original = ScanOptions {
48            verbose: true,
49            threads: 4,
50            skip: vec![PathBuf::from("test")],
51            max_depth: None,
52        };
53        let cloned = original.clone();
54
55        assert_eq!(original.verbose, cloned.verbose);
56        assert_eq!(original.threads, cloned.threads);
57        assert_eq!(original.skip, cloned.skip);
58    }
59}