Progress-Monitor

Track progress of any type in your Rust application.

Allows you to track part of your work with individual scales.

Usage

```rust use std::{fmt::Debug, thread, time::Duration}; use error::CloseError; use progress_monitor::prelude::*;

fn main() { // Numeric work let mut mon = CallbackProgressMonitor::new("root", 300, |a: &NumericWork, w: &NumericWork| { println!("{}/{}", w, a) }); mon.worked(1); thread::sleep(Duration::fromsecs(1)); mon.worked(99); { let mut sub = mon.newchild("a", 100, 5000); thread::sleep(Duration::frommillis(500)); sub.worked(1000); thread::sleep(Duration::frommillis(500)); sub.worked(1000); thread::sleep(Duration::frommillis(500)); sub.worked(1000); thread::sleep(Duration::frommillis(500)); sub.worked(1000); { let mut subsub = sub.newchild("b".tostring(), 1000, 10); thread::sleep(Duration::frommillis(100)); subsub.worked(2); thread::sleep(Duration::frommillis(100)); subsub.worked(2); thread::sleep(Duration::frommillis(100)); subsub.worked(2); thread::sleep(Duration::frommillis(100)); subsub.worked(2); thread::sleep(Duration::frommillis(100)); subsub.worked(2); subsub.close().unwrap(); } sub.close().unwrap(); } thread::sleep(Duration::fromsecs(1)); mon.worked(100); mon.close().unwrap();

// Set work
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
pub enum MyWork {
    ResourcesLoaded,
    ConnectionEstablished,
    SystemInitialized,
}
let mut mon = CallbackProgressMonitor::new(
    "root",
    &[MyWork::ResourcesLoaded, MyWork::SystemInitialized],
    |a: &SetWork<MyWork>, w: &SetWork<MyWork>| println!("{}/{}", w, a),
);
thread::sleep(Duration::from_secs(1));
mon.worked(MyWork::ResourcesLoaded);
thread::sleep(Duration::from_secs(1));
mon.worked(MyWork::ConnectionEstablished);
thread::sleep(Duration::from_secs(1));
mon.worked(MyWork::SystemInitialized);
mon.close().unwrap();

} ```

MSRV

The minimum supported rust version is 1.60.0