Rust Max Slice Sum
fn max_slice_sum(a: &[i64]) -> i64 {
    let mut tmp = a[0];
    let mut max = a[0];

    for &v in &a[1..] {
        tmp = (tmp + v).max(v);
        max = max.max(tmp);
    }

    max
}

This is a Kadane-style scan: keep the best running sum and the best overall sum while moving once through the array.