#range #utility #traits #dealing #helper #arguments #helps

anyrange

Small helper trait that helps dealing with range arguments

1 unstable release

Uses old Rust 2015

0.1.0 Sep 30, 2015

#35 in #helps

Download history 33/week @ 2024-04-08 30/week @ 2024-04-15 34/week @ 2024-04-22 33/week @ 2024-04-29 31/week @ 2024-05-06 35/week @ 2024-05-13 40/week @ 2024-05-20 35/week @ 2024-05-27 36/week @ 2024-06-03 27/week @ 2024-06-10 31/week @ 2024-06-17 32/week @ 2024-06-24 34/week @ 2024-07-08 30/week @ 2024-07-15 31/week @ 2024-07-22

98 downloads per month
Used in 2 crates (via multiarray)

MIT/Apache

3KB

This library provides an AnyRange trait that unifies the ranges std::ops::Range, std::ops::RangeFrom, std::ops::RangeTo and std::ops::RangeFull. It offers a function for converting artibrary kinds of ranges to "concrete" ranges that have a start and an end.

Examples

assert!( (10..20).to_range(0,100) == (10.. 20) );
assert!( (10..  ).to_range(0,100) == (10..100) );
assert!( (  ..20).to_range(0,100) == ( 0.. 20) );
assert!( (  ..  ).to_range(0,100) == ( 0..100) );

lib.rs:

This library provides an AnyRange trait that unifies the ranges std::ops::Range, std::ops::RangeFrom, std::ops::RangeTo and std::ops::RangeFull. It offers a function for converting artibrary kinds of ranges to "concrete" ranges that have a start and an end.

No runtime deps