@@ -7,27 +7,27 @@ use crate::{
77 os_string_display:: OsStringDisplay ,
88 reporter:: ParallelReporter ,
99 runtime_error:: RuntimeError ,
10- size:: Size ,
10+ size,
1111 status_board:: GLOBAL_STATUS_BOARD ,
1212 visualizer:: { BarAlignment , ColumnWidthDistribution , Direction , Visualizer } ,
1313} ;
1414use serde:: Serialize ;
1515use std:: { io:: stdout, iter:: once, num:: NonZeroUsize , path:: PathBuf } ;
1616
1717/// The sub program of the main application.
18- pub struct Sub < Data , GetData , Report >
18+ pub struct Sub < Size , SizeGetter , Report >
1919where
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 > ,
2424{
2525 /// List of files and/or directories.
2626 pub files : Vec < PathBuf > ,
2727 /// Print JSON data instead of an ASCII chart.
2828 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 ,
3131 /// The direction of the visualization.
3232 pub direction : Direction ,
3333 /// The alignment of the bars.
3636 pub column_width_distribution : ColumnWidthDistribution ,
3737 /// Maximum number of levels that should be visualized.
3838 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 ,
4141 /// Reports measurement progress.
4242 pub reporter : Report ,
4343 /// Minimal size proportion required to appear.
@@ -46,12 +46,12 @@ where
4646 pub no_sort : bool ,
4747}
4848
49- impl < Data , GetData , Report > Sub < Data , GetData , Report >
49+ impl < Size , SizeGetter , Report > Sub < Size , SizeGetter , Report >
5050where
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 > ,
5555{
5656 /// Run the sub program.
5757 pub fn run ( self ) -> Result < ( ) , RuntimeError > {
@@ -63,19 +63,19 @@ where
6363 bar_alignment,
6464 column_width_distribution,
6565 max_depth,
66- get_data ,
66+ size_getter ,
6767 reporter,
6868 min_ratio,
6969 no_sort,
7070 } = self ;
7171
7272 let mut iter = files
7373 . into_iter ( )
74- . map ( |root| -> DataTree < OsStringDisplay , Data > {
74+ . map ( |root| -> DataTree < OsStringDisplay , Size > {
7575 FsTreeBuilder {
7676 reporter : & reporter,
7777 root,
78- get_data ,
78+ size_getter ,
7979 }
8080 . into ( )
8181 } ) ;
9898 let children: Vec < _ > = once ( data_tree) . chain ( iter) . collect ( ) ;
9999 DataTree :: dir (
100100 OsStringDisplay :: os_string_from ( "(total)" ) ,
101- Data :: default ( ) ,
101+ Size :: default ( ) ,
102102 children,
103103 )
104104 } ;
@@ -114,7 +114,7 @@ where
114114 data_tree. par_cull_insignificant_data ( min_ratio) ;
115115 }
116116 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 ( ) ) ;
118118 }
119119 data_tree
120120 } ;
0 commit comments