pub fn comparison_combined_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];
    }

    let current_comparison_time = run.segment(segment_index).comparison(comparison)[method]?;

    let previous_comparison_time = find_previous_non_empty_comparison_time(
        &run.segments()[..segment_index],
        comparison,
        method,
    )
    .unwrap_or_default();

    Some(current_comparison_time - previous_comparison_time)
}
/// Calculates the comparison's segment time of the segment with the timing
/// method specified, combining segments if the segment before it is empty.
/// 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, combining segments if the segment before it is empty.
This is not calculating the current attempt's segment times.
Calculates the comparison ' s segment time of the segment with the timing method specified combining segments if the segment before it is empty . This is not calculating the current attempt ' s segment times .
pub fn comparison_combined_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];
    }
    let current_comparison_time = run.segment(segment_index).comparison(comparison)[method]?;
    let previous_comparison_time = find_previous_non_empty_comparison_time(
        &run.segments()[..segment_index],
        comparison,
        method,
    )
    .unwrap_or_default();
    Some(current_comparison_time - previous_comparison_time)
}
pub fn comparison_combined_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 ] ; } let current_comparison_time = run . segment ( segment_index ) . comparison ( comparison ) [ method ] ? ; let previous_comparison_time = find_previous_non_empty_comparison_time ( & run . segments ( ) [ .. segment_index ] , comparison , method , ) . unwrap_or_default ( ) ; Some ( current_comparison_time - previous_comparison_time ) }
Calculates the comparison's segment time of the segment with the timing
method specified, combining segments if the segment before it is empty.
Calculates the comparison ' s segment time of the segment with the timing method specified combining segments if the segment before it is empty .
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 () ` .