about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-02-22 01:51:58 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-02-22 01:51:58 +0530
commita95d7f53a7f80085c972adb996c6e10f705db4ef (patch)
tree9fd2b076da61eab26dd75497fc8ac8b7bc7bc7b6
parent3e794defda9ca576908d0485fb74de03fbfc4075 (diff)
parent355f35536d642fa8c9df9fe2d0b2290375749253 (diff)
downloadrust-a95d7f53a7f80085c972adb996c6e10f705db4ef.tar.gz
rust-a95d7f53a7f80085c972adb996c6e10f705db4ef.zip
Rollup merge of #22602 - steveklabnik:doc_range_step, r=alexcrichton
-rw-r--r--src/libcore/iter.rs49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 8fb10b5b2dc..2d50bbb6413 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -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")]