Skip to content

Commit

Permalink
auto merge of #15217 : steveklabnik/rust/range, r=huonw
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Jul 22, 2014
2 parents 428d814 + ba769d8 commit aa0e35b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,19 @@ pub struct Range<A> {
one: A
}

/// Return an iterator over the range [start, stop)
/// Returns an iterator over the given range [start, stop) (that is, starting
/// at start (inclusive), and ending at stop (exclusive)).
///
/// # Example
///
/// ```rust
/// let array = [0, 1, 2, 3, 4];
///
/// for i in range(0, 5u) {
/// println!("{}", i);
/// assert_eq!(i, array[i]);
/// }
/// ```
#[inline]
pub fn range<A: Add<A, A> + PartialOrd + Clone + One>(start: A, stop: A) -> Range<A> {
Range{state: start, stop: stop, one: One::one()}
Expand Down

0 comments on commit aa0e35b

Please sign in to comment.