Rollup merge of #22602 - steveklabnik:doc_range_step, r=alexcrichton

This commit is contained in:
Manish Goregaokar 2015-02-22 01:51:58 +05:30
commit a95d7f53a7

View File

@ -2592,7 +2592,29 @@ pub struct RangeStep<A> {
rev: bool,
}
/// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping.
/// Return an iterator over the range [start, stop) by `step`.
///
/// It handles overflow by stopping.
///
/// # Examples
///
/// ```
/// use std::iter::range_step;
///
/// for i in range_step(0, 10, 2) {
/// println!("{}", i);
/// }
/// ```
///
/// This prints:
///
/// ```text
/// 0
/// 2
/// 4
/// 6
/// 8
/// ```
#[inline]
#[unstable(feature = "core",
reason = "likely to be replaced by range notation and adapters")]
@ -2633,7 +2655,30 @@ pub struct RangeStepInclusive<A> {
done: bool,
}
/// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
/// Return an iterator over the range [start, stop] by `step`.
///
/// It handles overflow by stopping.
///
/// # Examples
///
/// ```
/// use std::iter::range_step_inclusive;
///
/// for i in range_step_inclusive(0, 10, 2) {
/// println!("{}", i);
/// }
/// ```
///
/// This prints:
///
/// ```text
/// 0
/// 2
/// 4
/// 6
/// 8
/// 10
/// ```
#[inline]
#[unstable(feature = "core",
reason = "likely to be replaced by range notation and adapters")]