quorum_set/progress/
vec_progress_entry.rs1pub trait VecProgressEntry {
8 type Id: 'static + PartialEq;
10
11 type Progress: Clone + Default + Ord;
13
14 fn id(&self) -> &Self::Id;
16
17 fn progress(&self) -> &Self::Progress;
19
20 fn progress_mut(&mut self) -> &mut Self::Progress;
22
23 fn id_progress(&self) -> (&Self::Id, &Self::Progress) {
25 (self.id(), self.progress())
26 }
27
28 fn id_progress_owned(&self) -> (Self::Id, Self::Progress)
30 where Self::Id: Clone {
31 let (id, progress) = self.id_progress();
32 (id.clone(), progress.clone())
33 }
34}
35
36pub trait VecProgressEntryData: VecProgressEntry {
38 type Data;
40
41 fn data(&self) -> &Self::Data;
43
44 fn data_mut(&mut self) -> &mut Self::Data;
46}
47
48impl<ID, Progress> VecProgressEntry for (ID, Progress)
49where
50 ID: 'static + PartialEq,
51 Progress: Clone + Default + Ord,
52{
53 type Id = ID;
54 type Progress = Progress;
55
56 fn id(&self) -> &Self::Id {
57 &self.0
58 }
59
60 fn progress(&self) -> &Self::Progress {
61 &self.1
62 }
63
64 fn progress_mut(&mut self) -> &mut Self::Progress {
65 &mut self.1
66 }
67}