Skip to content

Commit

Permalink
Clarify range's exclusivity.
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Jul 21, 2014
1 parent 428d814 commit ba769d8
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

5 comments on commit ba769d8

@bors
Copy link
Contributor

@bors bors commented on ba769d8 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at steveklabnik@ba769d8

@bors
Copy link
Contributor

@bors bors commented on ba769d8 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging steveklabnik/rust/range = ba769d8 into auto

@bors
Copy link
Contributor

@bors bors commented on ba769d8 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

steveklabnik/rust/range = ba769d8 merged ok, testing candidate = aa0e35b

@bors
Copy link
Contributor

@bors bors commented on ba769d8 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = aa0e35b

Please sign in to comment.