#step #range #less #index #indexed #expression #great

forangex

Range maker for foreward/backward and step may be larger than 1 (or less than -1), plus index support

4 releases

0.4.3 Nov 16, 2024
0.4.2 Nov 16, 2024
0.4.1 Nov 13, 2024
0.3.0 Nov 7, 2024

#1285 in Rust patterns

Download history 70/week @ 2024-11-01 142/week @ 2024-11-08 210/week @ 2024-11-15 19/week @ 2024-11-22 2/week @ 2024-11-29 2/week @ 2024-12-06

247 downloads per month

MIT/Apache

57KB
1.5K SLoC

rangex-rs

Clear range expression for exclusive/inclusive, forward/backward, and step great than 1 or less than -1, with index support


lib.rs:

This crate provides clear range expression for exclusive/inclusive, forward/backward, and step great than 1 or less than -1, with index support.

The most convenient way is to use the following macros:

range_inclusive!(start, stop)

This is the same as start..=stop

range_exclusive!(start, stop)

This is the same as start..stop

range_inclusive!(type, start, stop)

Creates range for type from start through stop, by step 1

range_inclusive!(type, start, stop, step)

Creates range for type from start through stop, by step

indexed_range_inclusive!(type, start, stop)

Creates indexed range for type from start through stop, by step 1

indexed_range_inclusive!(type, start, stop, step)

Creates indexed range for type from start through stop, by step

Dependencies

~465KB