range_rover

Crates.iorange_rover
lib.rsrange_rover
version0.1.2
sourcesrc
created_at2022-10-16 09:46:06.594925
updated_at2023-07-17 15:03:47.917595
descriptionFunction to pack integers into ranges..
homepage
repositoryhttps://github.com/p4ymak/range_rover
max_upload_size
id689382
size4,291
Roman Chumak (p4ymak)

documentation

README

Function to pack integers into ranges.

Takes a custom sequence of non-repeating integers and produces a sorted vector of ranges.

Example:

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]);
Commit count: 16

cargo fmt