Skip to main content

TransferProgress

Trait TransferProgress 

Source
pub trait TransferProgress: Send + Sync {
    // Provided methods
    fn begin(&self, _total_bytes: Option<u64>) { ... }
    fn advance(&self, _delta: u64) { ... }
    fn finish(&self) { ... }
}
Expand description

Progress sink for streaming uploads and downloads.

Implement this trait when you want upload and download helpers to report byte-level transfer progress into your own logging, UI, or terminal progress bar implementation.

Provided Methods§

Source

fn begin(&self, _total_bytes: Option<u64>)

Called once before the transfer starts.

total_bytes is Some(len) when the total size is known up front and None when the transfer length is unknown.

Source

fn advance(&self, _delta: u64)

Called after each successfully transferred chunk.

Source

fn finish(&self)

Called once after a transfer completes successfully.

Implementations on Foreign Types§

Source§

impl TransferProgress for ()

Source§

impl TransferProgress for ProgressBar

Available on crate feature indicatif only.
Source§

fn begin(&self, total_bytes: Option<u64>)

Source§

fn advance(&self, delta: u64)

Source§

fn finish(&self)

Source§

impl<P> TransferProgress for Arc<P>
where P: TransferProgress + ?Sized,

Source§

fn begin(&self, total_bytes: Option<u64>)

Source§

fn advance(&self, delta: u64)

Source§

fn finish(&self)

Implementors§