Trait Progress

Source
pub trait Progress:
    Clone
    + Send
    + Sync {
    // Required methods
    fn on_start(&mut self, unit: &ProgressUnit) -> Result<(), OpsError>;
    fn on_progress(&mut self, unit: &ProgressUnit) -> Result<(), OpsError>;
    fn on_finish(&mut self, unit: &ProgressUnit) -> Result<(), OpsError>;
}
Expand description

A trait defining the behavior for progress tracking during file downloads.

This trait allows implementors to handle the start, progress updates, and finish events of a download operation. It is designed to be thread-safe (Send + Sync) and clonable.

Required Methods§

Source

fn on_start(&mut self, unit: &ProgressUnit) -> Result<(), OpsError>

Called when a download starts.

Source

fn on_progress(&mut self, unit: &ProgressUnit) -> Result<(), OpsError>

Called periodically to update the progress of a download.

Source

fn on_finish(&mut self, unit: &ProgressUnit) -> Result<(), OpsError>

Called when a download finishes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§