Skip to main content

create_progress_bar

Function create_progress_bar 

Source
pub fn create_progress_bar(total: u64) -> ProgressBar
Expand description

Creates a standardized progress bar for determinate operations.

§Arguments

  • total - Total number of bytes or units to process

§Returns

A configured ProgressBar with:

  • 40-character visual bar
  • Elapsed time display
  • Bytes progress (current/total)
  • Estimated time to completion (ETA)

§Display Format

[00:01:23] =========>------------------------------ 234MB/1GB (00:02:15)

§Example

let file_size = 1024 * 1024 * 100; // 100 MB
let pb = create_progress_bar(file_size);

for _ in 0..100 {
    pb.inc(1024 * 1024);
}
pb.finish_with_message("Download complete");