pub struct OperationProgress {
pub operation_type: OperationType,
pub files_completed: usize,
pub files_total: usize,
pub bytes_processed: u64,
pub bytes_total: u64,
pub current_file: Option<PathBuf>,
pub errors: Vec<OperationError>,
pub started_at: Instant,
}Expand description
Progress information for an ongoing operation.
Fields§
§operation_type: OperationTypeThe type of operation.
files_completed: usizeNumber of files/directories completed.
files_total: usizeTotal number of files/directories to process.
bytes_processed: u64Number of bytes processed so far.
bytes_total: u64Total bytes to process (may be 0 if unknown).
current_file: Option<PathBuf>The file currently being processed.
errors: Vec<OperationError>Errors encountered so far.
started_at: InstantWhen the operation started; the basis for throughput and ETA.
Implementations§
Source§impl OperationProgress
impl OperationProgress
Sourcepub fn new(
operation_type: OperationType,
files_total: usize,
bytes_total: u64,
) -> Self
pub fn new( operation_type: OperationType, files_total: usize, bytes_total: u64, ) -> Self
Create a new progress tracker for an operation.
Sourcepub fn bytes_per_second(&self) -> f64
pub fn bytes_per_second(&self) -> f64
Average bytes per second since the operation started.
Sourcepub fn eta(&self) -> Option<Duration>
pub fn eta(&self) -> Option<Duration>
Estimated time remaining, when the byte total and rate are known.
Sourcepub fn percentage(&self) -> f64
pub fn percentage(&self) -> f64
Get the estimated progress as a percentage (0.0 to 100.0). Totals may become stale; 100% is not a terminal success signal.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if the operation has any errors.
Sourcepub fn error_count(&self) -> usize
pub fn error_count(&self) -> usize
Get the number of errors.
Sourcepub fn add_error(&mut self, error: OperationError)
pub fn add_error(&mut self, error: OperationError)
Retain at most 1,000 diagnostic records, preserving total counts through an explicit omission record after the first 999 details when truncated. Individual path/message payloads above 8 KiB become omission records too; native paths are never shortened into misleading partial filenames.
Sourcepub fn set_current_file(&mut self, path: Option<PathBuf>)
pub fn set_current_file(&mut self, path: Option<PathBuf>)
Update the current file being processed.
Sourcepub fn complete_file(&mut self, bytes: u64)
pub fn complete_file(&mut self, bytes: u64)
Increment the completed count and add bytes, saturating at counter limits.