pub fn comparison_single_segment_time(
    run: &Run,
    segment_index: usize,
    comparison: &str,
    method: TimingMethod,
) -> Option<TimeSpan> {
    if comparison == best_segments::NAME {
        return run.segment(segment_index).best_segment_time()[method];
    }

    if segment_index == 0 {
        run.segment(segment_index).comparison(comparison)[method]
    } else {
        let current_comparison_time = run.segment(segment_index).comparison(comparison)[method]?;

        let previous_comparison_time =
            run.segment(segment_index - 1).comparison(comparison)[method]?;

        Some(current_comparison_time - previous_comparison_time)
    }
}
/// Calculates the comparison's segment time of the segment with the timing
/// method specified. This is not calculating the current attempt's segment
/// times.
///
/// # Panics
///
/// Panics if the provided `segment_index` is greater than or equal to
/// `run.len()`.
Calculates the comparison's segment time of the segment with the timing
method specified. This is not calculating the current attempt's segment
times.
Calculates the comparison ' s segment time of the segment with the timing method specified . This is not calculating the current attempt ' s segment times .
pub fn comparison_single_segment_time(
    run: &Run,
    segment_index: usize,
    comparison: &str,
    method: TimingMethod,
) -> Option<TimeSpan> {
    if comparison == best_segments::NAME {
        return run.segment(segment_index).best_segment_time()[method];
    }
    if segment_index == 0 {
        run.segment(segment_index).comparison(comparison)[method]
    } else {
        let current_comparison_time = run.segment(segment_index).comparison(comparison)[method]?;
        let previous_comparison_time =
            run.segment(segment_index - 1).comparison(comparison)[method]?;
        Some(current_comparison_time - previous_comparison_time)
    }
}
pub fn comparison_single_segment_time ( run : & Run , segment_index : usize , comparison : & str , method : TimingMethod , ) -> Option < TimeSpan > { if comparison == best_segments :: NAME { return run . segment ( segment_index ) . best_segment_time ( ) [ method ] ; } if segment_index == 0 { run . segment ( segment_index ) . comparison ( comparison ) [ method ] } else { let current_comparison_time = run . segment ( segment_index ) . comparison ( comparison ) [ method ] ? ; let previous_comparison_time = run . segment ( segment_index - 1 ) . comparison ( comparison ) [ method ] ? ; Some ( current_comparison_time - previous_comparison_time ) } }
Calculates the comparison's segment time of the segment with the timing
method specified.
Calculates the comparison ' s segment time of the segment with the timing method specified .
run
&Run
segment_index
usize
comparison
&str
method
TimingMethod
run
&Run
segment_index
usize
comparison
&str
method
TimingMethod
panics
Panics if the provided `segment_index` is greater than or equal to
`run.len()`.
Panics if the provided ` segment_index ` is greater than or equal to ` run . len () ` .