File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,13 @@ impl DownloadTracker {
186
186
( remaining / speed) as u64
187
187
} ) ;
188
188
format ! (
189
- "{} / {} ({:3.0} %) {} in {} ETA: {}" ,
189
+ "{} / {} ({:3.0} %) {} in {}{}" ,
190
190
total_h,
191
191
content_len_h,
192
192
percent,
193
193
speed_h,
194
194
elapsed_h. display( ) ,
195
- eta_h . display ( ) ,
195
+ Eta ( eta_h ) ,
196
196
)
197
197
}
198
198
None => format ! (
@@ -220,6 +220,17 @@ impl DownloadTracker {
220
220
}
221
221
}
222
222
223
+ struct Eta ( Duration ) ;
224
+
225
+ impl fmt:: Display for Eta {
226
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
227
+ match self . 0 {
228
+ Duration :: ZERO => Ok ( ( ) ) ,
229
+ _ => f. write_fmt ( format_args ! ( "{}" , self . 0 . display( ) ) ) ,
230
+ }
231
+ }
232
+ }
233
+
223
234
trait DurationDisplay {
224
235
fn display ( self ) -> Display ;
225
236
}
You can’t perform that action at this time.
0 commit comments