#range #iterator #divide

divide_range

Split a range evenly into an iterator of smaller ranges

1 unstable release

Uses old Rust 2015

0.1.1 Jun 26, 2018

#12 in #divide

Download history 81/week @ 2024-07-21 55/week @ 2024-07-28 41/week @ 2024-08-04 13/week @ 2024-08-11 42/week @ 2024-08-18 26/week @ 2024-08-25 3/week @ 2024-09-01 23/week @ 2024-09-08 33/week @ 2024-09-15 35/week @ 2024-09-22 30/week @ 2024-09-29 60/week @ 2024-10-06 36/week @ 2024-10-13 23/week @ 2024-10-20 23/week @ 2024-10-27 41/week @ 2024-11-03

132 downloads per month
Used in 2 crates (via wakuchin)

MIT license

7KB
65 lines

split_range

Split a range evenly into an iterator of smaller ranges.

extern crate divide_range;
use divide_range::RangeDivisions;

let range = 1..18;
let mut iter = range.divide_evenly_into(5);

assert_eq!(Some(1..4), iter.next());
assert_eq!(Some(4..7), iter.next());
assert_eq!(Some(7..10), iter.next());
assert_eq!(Some(10..14), iter.next());
assert_eq!(Some(14..18), iter.next());
assert_eq!(None, iter.next());

Dependencies

~150KB