[][src]Function livesplit_core::analysis::sum_of_segments::worst::calculate

pub fn calculate(
    segments: &[Segment],
    predictions: &mut [Option<Prediction>],
    use_current_run: bool,
    method: TimingMethod
) -> Option<TimeSpan>

Calculates the Sum of Worst Segments for the timing method provided. This is the slowest time possible to complete a run of a category, based on information collected from all the previous attempts. This obviously isn't really the worst possible time, but may be useful information regardless. If there's an active attempt, you can choose to take it into account as well. This lower level function requires you to provide a buffer to fill up with the slowest paths to reach each of the segments. This means that the first segment will always be reached at a time of 0:00. However, if you are interested in the total Sum of Worst Segments, then you can't look at the predictions value with the index of the last segment, as that only tells you what the worst time to reach that segment is, not the worst time to complete it. This means that the predictions buffer needs to have one more element than the list of segments provided, so that you can properly query the total Sum of Worst Segments. This value is also the value that is being returned.