Crates.io | range_rover |
lib.rs | range_rover |
version | 0.1.2 |
source | src |
created_at | 2022-10-16 09:46:06.594925 |
updated_at | 2023-07-17 15:03:47.917595 |
description | Function to pack integers into ranges.. |
homepage | |
repository | https://github.com/p4ymak/range_rover |
max_upload_size | |
id | 689382 |
size | 4,291 |
Takes a custom sequence of non-repeating integers and produces a sorted vector of ranges.
use range_rover::range_rover;
let input = vec![-1, -2, 2, 0, 7, 10, -4, 1, 3, 6, -3, 4, 9, 8];
let result = range_rover(input);
assert_eq!(result, vec![-4..=4, 6..=10]);