4 releases

0.2.0 Jun 12, 2020
0.1.2 Jun 12, 2020
0.1.1 Jun 12, 2020
0.1.0 Jun 12, 2020

#7 in #modulo

Download history 1/week @ 2022-12-02 3/week @ 2022-12-16 3/week @ 2022-12-30 1/week @ 2023-01-06 1/week @ 2023-01-20 6/week @ 2023-01-27 6/week @ 2023-02-03 13/week @ 2023-02-10 16/week @ 2023-02-17 5/week @ 2023-02-24 13/week @ 2023-03-03 63/week @ 2023-03-10 29/week @ 2023-03-17

110 downloads per month

MIT license

4KB

Docs Build Status

wrapping

Wrapping around for slices.

Implements a wrapper around slices that allows for indexing beyond the length of the slice, by taking the index always modulo the length.

Example

use wrapping::Wrapping;

let array: [&str; 1] = ["hello"];
let wrapping = Wrapping::from(&array[..]);

assert_eq!(wrapping[0], "hello");
assert_eq!(wrapping[1], "hello");

lib.rs:

Wrapping around for slices.

Implements a wrapper around slices that allows for indexing beyond the length of the slice, by taking the index always modulo the length.

Example

use wrapping::Wrapping;

let array: [&str; 1] = ["hello"];
let wrapping = Wrapping::from(&array[..]);

assert_eq!(wrapping[0], "hello");
assert_eq!(wrapping[1], "hello");

No runtime deps