pub trait ProgressCallback: Send {
// Required methods
fn on_entry_start(&mut self, path: &Path, total: usize, current: usize);
fn on_bytes_written(&mut self, bytes: u64);
fn on_entry_complete(&mut self, path: &Path);
fn on_complete(&mut self);
}Expand description
Callback trait for progress reporting during archive operations.
Implement this trait to receive progress updates during extraction or
creation. The trait requires Send to allow use in multi-threaded contexts.
§Examples
use exarch_core::ProgressCallback;
use std::path::Path;
struct SimpleProgress;
impl ProgressCallback for SimpleProgress {
fn on_entry_start(&mut self, path: &Path, total: usize, current: usize) {
println!("Processing {}/{}: {}", current, total, path.display());
}
fn on_bytes_written(&mut self, bytes: u64) {
// Track bytes written
}
fn on_entry_complete(&mut self, path: &Path) {
println!("Completed: {}", path.display());
}
fn on_complete(&mut self) {
println!("Operation complete");
}
}Required Methods§
Sourcefn on_entry_start(&mut self, path: &Path, total: usize, current: usize)
fn on_entry_start(&mut self, path: &Path, total: usize, current: usize)
Called when starting to process an entry.
§Arguments
path- Path of the entry being processedtotal- Total number of entries in the archivecurrent- Current entry number (1-indexed)
Sourcefn on_bytes_written(&mut self, bytes: u64)
fn on_bytes_written(&mut self, bytes: u64)
Called when bytes are written during extraction or read during creation.
§Arguments
bytes- Number of bytes written/read in this update
Sourcefn on_entry_complete(&mut self, path: &Path)
fn on_entry_complete(&mut self, path: &Path)
Called when an entry has been completely processed.
§Arguments
path- Path of the entry that was completed
Sourcefn on_complete(&mut self)
fn on_complete(&mut self)
Called when the entire operation is complete.