eukap / itemops

Some additional methods for Rust slices

Home Page:https://crates.io/crates/itemops

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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);

About

Some additional methods for Rust slices

https://crates.io/crates/itemops

License:MIT License


Languages

Language:Rust 100.0%