pub fn import_pb_into_segment_history(&mut self) {
        if let Some(mut index) = self.min_segment_history_index() {
            for timing_method in TimingMethod::all() {
                index -= 1;
                let mut prev_time = TimeSpan::zero();

                for segment in self.segments_mut() {
                    // Import the PB splits into the history
                    let pb_time = segment.personal_best_split_time()[timing_method];
                    let time = Time::new()
                        .with_timing_method(timing_method, pb_time.map(|p| p - prev_time));
                    segment.segment_history_mut().insert(index, time);

                    if let Some(time) = pb_time {
                        prev_time = time;
                    }
                }
            }
        }
    }
/// Fixes the Segment History by calculating the segment times from the
/// Personal Best times and adding those to the Segment History.
Fixes the Segment History by calculating the segment times from the
Personal Best times and adding those to the Segment History.
Fixes the Segment History by calculating the segment times from the Personal Best times and adding those to the Segment History .
pub fn import_pb_into_segment_history(&mut self) {
        if let Some(mut index) = self.min_segment_history_index() {
            for timing_method in TimingMethod::all() {
                index -= 1;
                let mut prev_time = TimeSpan::zero();
                for segment in self.segments_mut() {
                    // Import the PB splits into the history
                    let pb_time = segment.personal_best_split_time()[timing_method];
                    let time = Time::new()
                        .with_timing_method(timing_method, pb_time.map(|p| p - prev_time));
                    segment.segment_history_mut().insert(index, time);
                    if let Some(time) = pb_time {
                        prev_time = time;
                    }
                }
            }
        }
    }
pub fn import_pb_into_segment_history ( & mut self ) { if let Some ( mut index ) = self . min_segment_history_index ( ) { for timing_method in TimingMethod :: all ( ) { index -= 1 ; let mut prev_time = TimeSpan :: zero ( ) ; for segment in self . segments_mut ( ) { // Import the PB splits into the history let pb_time = segment . personal_best_split_time ( ) [ timing_method ] ; let time = Time :: new ( ) . with_timing_method ( timing_method , pb_time . map ( | p | p - prev_time ) ) ; segment . segment_history_mut ( ) . insert ( index , time ) ; if let Some ( time ) = pb_time { prev_time = time ; } } } } }
Fixes the Segment History by calculating the segment times from the
Personal Best times and adding those to the Segment History.
Fixes the Segment History by calculating the segment times from the Personal Best times and adding those to the Segment History .
&mut self
&mut self