progress_monitor/work/
mod.rs1use std::{
2 fmt::{Debug, Display},
3 ops::{Add, Sub},
4};
5
6pub mod numeric;
7pub mod set;
8
9#[derive(Debug)]
10pub struct AddError {
11 pub msg: String,
12}
13
14pub trait Work:
15 Sized
16 + Debug
17 + Display
18 + Add<Output = Result<Self, AddError>>
19 + Sub<Output = Self>
20 + PartialEq
21 + PartialOrd
22 + Clone
23{
24 type Type;
25
26 fn new<A: Into<Self::Type>>(value: A) -> Self;
27 fn zero() -> Self;
28 fn min<'a>(a: &'a Self, b: &'a Self) -> &'a Self;
29
30 fn parent_work_done_when(
31 sub_work_done: Self,
32 of_total_sub_work: Self,
33 of_parent_work: Self,
34 ) -> Self;
35}