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

anyrange

Small helper trait that helps dealing with range arguments

1 unstable release

Uses old Rust 2015

0.1.0 Sep 30, 2015

#29 in #helps

Download history 8/week @ 2024-01-06 10/week @ 2024-01-13 3/week @ 2024-01-20 14/week @ 2024-02-10 29/week @ 2024-02-17 22/week @ 2024-02-24 43/week @ 2024-03-02 41/week @ 2024-03-09 32/week @ 2024-03-16 64/week @ 2024-03-23 90/week @ 2024-03-30 27/week @ 2024-04-06 41/week @ 2024-04-13 27/week @ 2024-04-20

192 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