pub struct TargetScanner { /* private fields */ }Expand description
Streaming target scanner — walks a directory incrementally and yields entries.
Call TargetScanner::new to initialise the scanner (performs a shallow
directory enumeration to build the pending list), then drive it with
next_entry or drain everything at once with
collect_all.
Implementations§
Source§impl TargetScanner
impl TargetScanner
Sourcepub fn new(dir: &Path) -> Result<Self>
pub fn new(dir: &Path) -> Result<Self>
Create a scanner from a directory path.
Immediately performs a recursive walk of dir to collect all .target
file paths into the pending list — no file parsing happens here.
Returns an error if dir does not exist.
Sourcepub fn total(&self) -> usize
pub fn total(&self) -> usize
Estimated total number of .target files found during initialisation.
Sourcepub fn progress(&self) -> f32
pub fn progress(&self) -> f32
Progress in [0.0, 1.0]. Returns 1.0 when there are no files or
when all files have been processed.
Sourcepub fn next_entry(&mut self) -> Option<TargetEntry>
pub fn next_entry(&mut self) -> Option<TargetEntry>
Process the next pending file and return a TargetEntry.
Returns None when all files have been processed. Files that fail
to parse are silently skipped (the counter is still incremented).
Sourcepub fn collect_all(self) -> TargetIndex
pub fn collect_all(self) -> TargetIndex
Drain all remaining entries into a TargetIndex.