Crates.io | wrapping |
lib.rs | wrapping |
version | 0.2.0 |
source | src |
created_at | 2020-06-12 19:29:00.802791 |
updated_at | 2020-06-12 21:05:11.174742 |
description | Wrapping slices and arrays |
homepage | |
repository | https://git.ureeves.com/ureeves/wrapping |
max_upload_size | |
id | 253370 |
size | 6,886 |
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.
use wrapping::Wrapping;
let array: [&str; 1] = ["hello"];
let wrapping = Wrapping::from(&array[..]);
assert_eq!(wrapping[0], "hello");
assert_eq!(wrapping[1], "hello");