[−][src]Trait itemops::ops::ItemSum
An item summing trait.
Associated Types
type Item
Required methods
Loading content...Implementations on Foreign Types
impl<'_, T> ItemSum for &'_ [T] where
T: Default + AddAssign + Copy,
[src]
T: Default + AddAssign + Copy,
type Item = T
fn sum_step(self, step: usize) -> Self::Item
[src]
Sums elements of a slice with a specified step.
If a slice is empty or a step is equal to zero, returns the default value of the item type.
Panics
This method will panic if the computation overflows and debug assertions are enabled.
Examples
let v = vec![3, 7, 4, 2, 8, 5]; assert_eq!(v.sum_step(2), 15); assert_eq!(v.sum_step(3), 5);