File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -274,17 +274,21 @@ impl Stopwatch {
274
274
275
275
impl AsModel for Stopwatch {
276
276
fn status ( & self ) -> String {
277
- let durations: Vec < f64 > = self
278
- . state
279
- . jobs
280
- . iter ( )
281
- . filter_map ( |job| self . some_duration ( job) )
282
- . map ( |( _, duration) | duration)
283
- . collect ( ) ;
284
- format ! [
285
- "Average {:.3}" ,
286
- durations. iter( ) . sum:: <f64 >( ) / durations. len( ) as f64
287
- ]
277
+ if self . state . jobs . is_empty ( ) {
278
+ String :: from ( "Measuring durations" )
279
+ } else {
280
+ let durations: Vec < f64 > = self
281
+ . state
282
+ . jobs
283
+ . iter ( )
284
+ . filter_map ( |job| self . some_duration ( job) )
285
+ . map ( |( _, duration) | duration)
286
+ . collect ( ) ;
287
+ format ! [
288
+ "Average {:.3}" ,
289
+ durations. iter( ) . sum:: <f64 >( ) / durations. len( ) as f64
290
+ ]
291
+ }
288
292
}
289
293
290
294
fn events_ext (
You can’t perform that action at this time.
0 commit comments