ProgressCallback

Trait ProgressCallback 

Source
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§

Source

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 processed
  • total - Total number of entries in the archive
  • current - Current entry number (1-indexed)
Source

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
Source

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
Source

fn on_complete(&mut self)

Called when the entire operation is complete.

Implementors§