# `wrapping_in_range`
[](https://crates.io/crates/wrapping_in_range)
[](https://docs.rs/wrapping_in_range)


[](https://github.com/nik-rev/wrapping-in-range)
Wrapping-in-range arithmetic for custom ranges via the [`WrappingInRange`](https://docs.rs/wrapping_in_range/latest/wrapping_in_range/struct.WrappingInRange.html) type
```toml
[dependencies]
wrapping_in_range = "0.1"
```
These arithmetic operations act just like `std`'s `.wrapping_sub()`, `.wrapping_add()`, etc. but for a custom user-provided range.
## Examples
```rust
use wrapping_in_range::WrappingInRange;
assert_eq!(
[-2, -1, 0, 1, 2].map(|i| w(i) - 1),
[ 0, 1, -1, 0, 1]
);
assert_eq!(
[-2, -1, 0, 1, 2].map(|i| w(i) + 1),
[-1, 0, 1, -1, 0]
);
```