multi-progressbar 0.1.0

A library for displaying multiple progress bars in the terminal designed to not stand in your way.
Documentation
  • Coverage
  • 100%
    19 out of 19 items documented1 out of 15 items with examples
  • Size
  • Source code size: 25.59 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.36 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • eternal-flame-AD/multi-progressbar
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • eternal-flame-AD

multi-progress

multi-progress is a library to show multiple progress bars along with log outputs in terminal.

Usage

  1. Implement TaskProgress trait for your task.
  2. Create a MultiProgressBar with a ProgressBar implementation (provided in the bar module).
  3. Call MultiProgressBar::draw to draw progress bars when needed.
use multi_progressbar::{
    MultiProgressBar, TaskProgress,
    bar::classic::ClassicProgressBar
};

struct Task {
    name: String,
    progress: u64,
    total: u64,
}

impl TaskProgress for Task {
    fn progress(&self) -> (u64, u64) {
        (self.progress, self.total)
    }
    fn after(&self) -> Option<String> {
        Some(format!("{}/{} completed", self.progress, self.total))
    }
    fn before(&self) -> Option<String> {
        Some(self.name.clone())
    }
}

let mp = MultiProgressBar::new(ClassicProgressBar::new());
let task1 = Task {
   name: "task1".to_string(),
   progress: 0,
   total: 100,
};
let task2 = Task {
    name: "task2".to_string(),
    progress: 33,
    total: 100,
};
let tasks = vec![task1, task2];
mp.draw(&tasks).unwrap();