#slice #product #vector #sum #array

itemops

Provides some operations on items of slices

2 releases

0.1.1 Feb 12, 2020
0.1.0 Sep 6, 2019

#2417 in Algorithms

MIT license

5KB

Crates.io

Description

itemops provides some operations on items of Rust language slices.

Examples

For summing elements of a slice with a specified step:

let v = vec![3, 7, 4, 2, 8, 5];

assert_eq!(v.sum_step(2), 15);
assert_eq!(v.sum_step(3), 5);

For multiplying elements of a slice with a specified step:

let a = [2, 5, 1, 6, 3, 7];

assert_eq!(a.product_step(2), 6);
assert_eq!(a.product_step(3), 12);

lib.rs:

Provides some operations on items of slices.

No runtime deps