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>,
}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.
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 percentage(&self) -> f64
pub fn percentage(&self) -> f64
Get the progress as a percentage (0.0 to 100.0).
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)
Add an error to the progress.
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.
Trait Implementations§
Source§impl Clone for OperationProgress
impl Clone for OperationProgress
Source§fn clone(&self) -> OperationProgress
fn clone(&self) -> OperationProgress
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OperationProgress
impl RefUnwindSafe for OperationProgress
impl Send for OperationProgress
impl Sync for OperationProgress
impl Unpin for OperationProgress
impl UnsafeUnpin for OperationProgress
impl UnwindSafe for OperationProgress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more