Function num::range

source · []
pub fn range<A>(start: A, stop: A) -> Range<A>Notable traits for Range<A>impl<A> Iterator for Range<A>where
    A: Add<A, Output = A> + PartialOrd<A> + Clone + ToPrimitive,
type Item = A;
where
    A: Add<A, Output = A> + PartialOrd<A> + Clone + One,
Expand description

Returns an iterator over the given range [start, stop) (that is, starting at start (inclusive), and ending at stop (exclusive)).

Example

let array = [0, 1, 2, 3, 4];

for i in num_iter::range(0, 5) {
    println!("{}", i);
    assert_eq!(i,  array[i]);
}