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 |
#1302 in Data structures
5KB
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");