Module prefix_sum::range
source · Expand description
Types for slices of a PrefixSum
.
The types in this module allow range modifications to a PrefixSum
, and are obtained
through the IndexMut
trait.
Example
use prefix_sum::PrefixSum;
let mut sum = PrefixSum::new(6);
sum[2..5] += 2;
sum[ .. ] += 3;
sum[ ..3] -= 1;
sum[1.. ] += -1;
assert_eq!(vec![2, 1, 3, 4, 4, 2], sum.build());
Structs
A closed range into a
PrefixSum
.A range into a
PrefixSum
with no upper bound.