fn runtime_downtime(steps: &[Step], after_all_steps: Instant) -> IntervalTree<Instant> {
            let mut downtime_before = None;
            let mut runtime_downtime = IntervalTree::default();
            for step in steps {
                match step.res {
                    // We tried to start the runtime and it succeeded.
                    Res::Start(Ok(_)) => match downtime_before.take() {
                        Some(downtime_before) => {
                            runtime_downtime.push(downtime_before, step.meta.after)
                        }
                        None => {}
                    },
                    // We either tried to start the runtime and it failed (most
                    // likely the storage was down) or we stopped the runtime.
                    Res::Start(Err(_)) | Res::Stop(_) => {
                        if downtime_before.is_none() {
                            downtime_before = Some(step.meta.before)
                        }
                    }
                    _ => {}
                }
            }
            // If downtime_before is still a Some, that means the test ended in
            // downtime.
            if let Some(downtime_before) = downtime_before.take() {
                runtime_downtime.push(downtime_before, after_all_steps);
            }
            runtime_downtime
        }
// NB: Steps must be sorted by before.
Steps must be sorted by before.
Steps must be sorted by before .
fn runtime_downtime(steps: &[Step], after_all_steps: Instant) -> IntervalTree<Instant> {
            let mut downtime_before = None;
            let mut runtime_downtime = IntervalTree::default();
            for step in steps {
                match step.res {
                    // We tried to start the runtime and it succeeded.
                    Res::Start(Ok(_)) => match downtime_before.take() {
                        Some(downtime_before) => {
                            runtime_downtime.push(downtime_before, step.meta.after)
                        }
                        None => {}
                    },
                    // We either tried to start the runtime and it failed (most
                    // likely the storage was down) or we stopped the runtime.
                    Res::Start(Err(_)) | Res::Stop(_) => {
                        if downtime_before.is_none() {
                            downtime_before = Some(step.meta.before)
                        }
                    }
                    _ => {}
                }
            }
            // If downtime_before is still a Some, that means the test ended in
            // downtime.
            if let Some(downtime_before) = downtime_before.take() {
                runtime_downtime.push(downtime_before, after_all_steps);
            }
            runtime_downtime
        }
fn runtime_downtime ( steps : & [ Step ] , after_all_steps : Instant ) -> IntervalTree < Instant > { let mut downtime_before = None ; let mut runtime_downtime = IntervalTree :: default ( ) ; for step in steps { match step . res { // We tried to start the runtime and it succeeded. Res :: Start ( Ok ( _ ) ) => match downtime_before . take ( ) { Some ( downtime_before ) => { runtime_downtime . push ( downtime_before , step . meta . after ) } None => { } } , // We either tried to start the runtime and it failed (most // likely the storage was down) or we stopped the runtime. Res :: Start ( Err ( _ ) ) | Res :: Stop ( _ ) => { if downtime_before . is_none ( ) { downtime_before = Some ( step . meta . before ) } } _ => { } } } // If downtime_before is still a Some, that means the test ended in // downtime. if let Some ( downtime_before ) = downtime_before . take ( ) { runtime_downtime . push ( downtime_before , after_all_steps ) ; } runtime_downtime }
NB: Steps must be sorted by before.
NB : Steps must be sorted by before .
steps
&[Step]
after_all_steps
Instant
steps
&[Step]
after_all_steps
Instant