Crates.io | itemops |
lib.rs | itemops |
version | 0.1.1 |
source | src |
created_at | 2019-09-06 15:28:17.705869 |
updated_at | 2020-02-12 23:46:48.08993 |
description | Provides some operations on items of slices |
homepage | |
repository | https://github.com/eukap/itemops |
max_upload_size | |
id | 162804 |
size | 5,675 |
itemops provides some operations on items of Rust language slices.
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);