#range #write #quick

a-range

Write quick and explict ranges in Rust

1 unstable release

Uses old Rust 2015

0.1.0 Oct 18, 2018

#90 in #quick

Apache-2.0 OR MIT

11KB
149 lines

A Range

Write quick and explict ranges in Rust

Build Status

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Create ranges in a very explicit manner

Start with the [from()] function and build up a range using From::up_to or From::down_to.

Examples

extern crate a_range;

let x = a_range::from(5).up_to(7);
assert_eq!(x.to_vec(), vec![5, 6, 7]);

let x = a_range::from(3).down_to(1);
assert_eq!(x.to_vec(), vec![3, 2, 1]);

Dependencies

~150KB