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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Progress bar styling
// (c) 2024 Ross Younger
/// Maximum update frequency we will use for the progress display
pub const MAX_UPDATE_FPS: u8 = 30;
/// A single-line style format for Indicatif which should cover most situations.
///
/// ```text
/// 11111111111111111111111111111111111111111111111111111111111111111111111111111111
/// filename [========================== ] 2m30s @ 123.4MB/s [70%/1.24GB]
/// fairly-long-filename [==================== ] 2m30s @ 123.4MB/s [70%/1.24GB]
/// extremely-long-filename-no-really-very-long [== ] 2m30s @ 123.4MB/s [70%/1.24GB]
/// 11111111111111111111111111111111111111111111111111111111111111111111111111111111
///
const PROGRESS_STYLE_COMPACT: &str =
"{msg:.dim} {wide_bar:.cyan} {eta} @ {decimal_bytes_per_sec} [{decimal_total_bytes:.dim}]";
/// Space to allow for the filename
///
/// We need about 35 characters for the data readout.
/// A useful progress bar needs maybe 20 characters.
/// This informs how much space we can allow for the filename.
const DATA_AND_PROGRESS: usize = 55;
/// A double-line style format for Indicatif for use when the filename is too long.
///
/// ```text
/// 11111111111111111111111111111111111111111111111111111111111111111111111111111111
/// extremely-long-filename-no-really-very-long [70%/1.24GB]
/// [========================== ] 2m30s @ 123.4MB/s
/// 11111111111111111111111111111111111111111111111111111111111111111111111111111111
/// ```
const PROGRESS_STYLE_OVERLONG: &str = "{wide_msg:.dim} [{decimal_total_bytes:.dim}]\n{wide_bar:.cyan} {eta} @ {decimal_bytes_per_sec}";
/// Determine and retrieve the appropriate progress style to use
pub
/// Indicatif template for spinner lines
pub const SPINNER_TEMPLATE: &str = "{spinner} {wide_msg} {prefix}";