#range #utility #traits #helper #dealing #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

#38 in #helps

Download history 26/week @ 2024-10-16 19/week @ 2024-10-23 22/week @ 2024-10-30 18/week @ 2024-11-06 7/week @ 2024-11-13 22/week @ 2024-11-20 31/week @ 2024-11-27 32/week @ 2024-12-04 78/week @ 2024-12-11 26/week @ 2024-12-18 21/week @ 2025-01-01 34/week @ 2025-01-08 57/week @ 2025-01-15 41/week @ 2025-01-22 34/week @ 2025-01-29

171 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