1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::{size::Size, status_board::GLOBAL_STATUS_BOARD};
use std::fmt::Write;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct ProgressReport<Data: Size> {
pub items: u64,
pub total: Data,
pub errors: u64,
}
impl<Data: Size + Into<u64>> ProgressReport<Data> {
pub const TEXT: fn(Self) = |report| {
let ProgressReport {
items,
total,
errors,
} = report;
let mut text = String::new();
write!(
text,
"\r(scanned {items}, total {total}",
items = items,
total = total.into(),
)
.unwrap();
if errors != 0 {
write!(text, ", erred {}", errors).unwrap();
}
write!(text, ")").unwrap();
GLOBAL_STATUS_BOARD.temporary_message(&text);
};
}