progress_monitor/monitor/
mod.rs1use std::{borrow::Cow, fmt::Debug, fmt::Display};
2
3use crate::{prelude::CloseError, work::Work};
4
5use self::sub::ChildMonitor;
6
7pub mod callback;
8pub mod sub;
9
10pub trait ProgressMonitor<W: Work>: Debug + Display {
12 fn worked<A: Into<W>>(&mut self, amount_of_work: A);
13
14 fn total(&self) -> &W;
15
16 fn completed(&self) -> &W;
17
18 fn remaining(&self) -> Cow<W>;
19
20 fn close(&mut self) -> Result<(), CloseError>;
22}
23
24pub trait ProgressMonitorDivision<'p, 'n, N, W, A1, A2>
25where
26 Self: ProgressMonitor<W> + Sized,
27 N: Into<Cow<'n, str>>,
28 W: Work,
29 A1: Into<W>,
30 A2: Into<W>,
31{
32 fn new_child(
33 &'p mut self,
35 name: N,
37 parent_work: A1,
39 child_work: A2,
41 ) -> ChildMonitor<'n, 'p, W, Self>;
42}