Crates.io | anyrange |
lib.rs | anyrange |
version | 0.1.0 |
source | src |
created_at | 2015-09-30 17:52:46.103754 |
updated_at | 2015-12-11 23:54:29.779751 |
description | Small helper trait that helps dealing with range arguments |
homepage | https://github.com/sellibitze/anyrange |
repository | https://github.com/sellibitze/anyrange.git |
max_upload_size | |
id | 3138 |
size | 4,688 |
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.
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) );