Skip to main content

dux_core/scanner/
progress.rs

1use std::path::PathBuf;
2
3/// Progress update during scanning
4#[derive(Debug, Clone)]
5pub enum ScanMessage {
6    /// Started scanning a directory
7    StartedDirectory(PathBuf),
8    /// Progress update
9    Progress(ScanProgress),
10    /// Finalizing (aggregating sizes, sorting)
11    Finalizing,
12    /// Scan completed
13    Completed,
14    /// Scan was cancelled
15    Cancelled,
16    /// Error during scanning
17    Error(String),
18}
19
20/// Scanning progress statistics
21#[derive(Debug, Clone, Default)]
22pub struct ScanProgress {
23    /// Number of files scanned
24    pub files_scanned: u64,
25    /// Number of directories scanned
26    pub dirs_scanned: u64,
27    /// Total bytes scanned so far
28    pub bytes_scanned: u64,
29    /// Number of errors encountered
30    pub errors: u64,
31    /// Current directory being scanned
32    pub current_path: Option<PathBuf>,
33}
34
35impl ScanProgress {
36    pub fn total_entries(&self) -> u64 {
37        self.files_scanned + self.dirs_scanned
38    }
39}