#range #iterator #smaller #split #divide #evenly #range-divisions

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

#10 in #divide

Download history 4/week @ 2024-04-19 6/week @ 2024-04-26 71/week @ 2024-05-03 122/week @ 2024-05-10 59/week @ 2024-05-17 62/week @ 2024-05-24 43/week @ 2024-05-31 54/week @ 2024-06-07 22/week @ 2024-06-14 53/week @ 2024-06-21 33/week @ 2024-06-28 45/week @ 2024-07-05 73/week @ 2024-07-12 100/week @ 2024-07-19 44/week @ 2024-07-26

266 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