@@ -7,27 +7,27 @@ use crate::{
7
7
os_string_display:: OsStringDisplay ,
8
8
reporter:: ParallelReporter ,
9
9
runtime_error:: RuntimeError ,
10
- size:: Size ,
10
+ size,
11
11
status_board:: GLOBAL_STATUS_BOARD ,
12
12
visualizer:: { BarAlignment , ColumnWidthDistribution , Direction , Visualizer } ,
13
13
} ;
14
14
use serde:: Serialize ;
15
15
use std:: { io:: stdout, iter:: once, num:: NonZeroUsize , path:: PathBuf } ;
16
16
17
17
/// The sub program of the main application.
18
- pub struct Sub < Data , GetData , Report >
18
+ pub struct Sub < Size , SizeGetter , Report >
19
19
where
20
- Data : Size + Into < u64 > + Serialize + Send + Sync ,
21
- Report : ParallelReporter < Data > + Sync ,
22
- GetData : GetSize < Size = Data > + Copy + Sync ,
23
- DataTreeReflection < String , Data > : Into < UnitAndTree > ,
20
+ Report : ParallelReporter < Size > + Sync ,
21
+ Size : size :: Size + Into < u64 > + Serialize + Send + Sync ,
22
+ SizeGetter : GetSize < Size = Size > + Copy + Sync ,
23
+ DataTreeReflection < String , Size > : Into < UnitAndTree > ,
24
24
{
25
25
/// List of files and/or directories.
26
26
pub files : Vec < PathBuf > ,
27
27
/// Print JSON data instead of an ASCII chart.
28
28
pub json_output : bool ,
29
- /// Format to be used to [`display`](Size::display) the data .
30
- pub bytes_format : Data :: DisplayFormat ,
29
+ /// Format to be used to [`display`](size:: Size::display) the sizes returned by [`size_getter`](Self::size_getter) .
30
+ pub bytes_format : Size :: DisplayFormat ,
31
31
/// The direction of the visualization.
32
32
pub direction : Direction ,
33
33
/// The alignment of the bars.
36
36
pub column_width_distribution : ColumnWidthDistribution ,
37
37
/// Maximum number of levels that should be visualized.
38
38
pub max_depth : NonZeroUsize ,
39
- /// Returns measured quantity of the files/directories.
40
- pub get_data : GetData ,
39
+ /// [Get the size](GetSize) of files/directories.
40
+ pub size_getter : SizeGetter ,
41
41
/// Reports measurement progress.
42
42
pub reporter : Report ,
43
43
/// Minimal size proportion required to appear.
@@ -46,12 +46,12 @@ where
46
46
pub no_sort : bool ,
47
47
}
48
48
49
- impl < Data , GetData , Report > Sub < Data , GetData , Report >
49
+ impl < Size , SizeGetter , Report > Sub < Size , SizeGetter , Report >
50
50
where
51
- Data : Size + Into < u64 > + Serialize + Send + Sync ,
52
- Report : ParallelReporter < Data > + Sync ,
53
- GetData : GetSize < Size = Data > + Copy + Sync ,
54
- DataTreeReflection < String , Data > : Into < UnitAndTree > ,
51
+ Size : size :: Size + Into < u64 > + Serialize + Send + Sync ,
52
+ Report : ParallelReporter < Size > + Sync ,
53
+ SizeGetter : GetSize < Size = Size > + Copy + Sync ,
54
+ DataTreeReflection < String , Size > : Into < UnitAndTree > ,
55
55
{
56
56
/// Run the sub program.
57
57
pub fn run ( self ) -> Result < ( ) , RuntimeError > {
@@ -63,19 +63,19 @@ where
63
63
bar_alignment,
64
64
column_width_distribution,
65
65
max_depth,
66
- get_data ,
66
+ size_getter ,
67
67
reporter,
68
68
min_ratio,
69
69
no_sort,
70
70
} = self ;
71
71
72
72
let mut iter = files
73
73
. into_iter ( )
74
- . map ( |root| -> DataTree < OsStringDisplay , Data > {
74
+ . map ( |root| -> DataTree < OsStringDisplay , Size > {
75
75
FsTreeBuilder {
76
76
reporter : & reporter,
77
77
root,
78
- get_data ,
78
+ size_getter ,
79
79
}
80
80
. into ( )
81
81
} ) ;
98
98
let children: Vec < _ > = once ( data_tree) . chain ( iter) . collect ( ) ;
99
99
DataTree :: dir (
100
100
OsStringDisplay :: os_string_from ( "(total)" ) ,
101
- Data :: default ( ) ,
101
+ Size :: default ( ) ,
102
102
children,
103
103
)
104
104
} ;
@@ -114,7 +114,7 @@ where
114
114
data_tree. par_cull_insignificant_data ( min_ratio) ;
115
115
}
116
116
if !no_sort {
117
- data_tree. par_sort_by ( |left, right| left. data ( ) . cmp ( & right. data ( ) ) . reverse ( ) ) ;
117
+ data_tree. par_sort_by ( |left, right| left. size ( ) . cmp ( & right. size ( ) ) . reverse ( ) ) ;
118
118
}
119
119
data_tree
120
120
} ;
0 commit comments