about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-30 16:07:08 +0000
committerbors <bors@rust-lang.org>2015-12-30 16:07:08 +0000
commitefb5a9a9f03016b8d3d3c13f940bbbfeac2cdfa6 (patch)
treeb0f93c0d1e3be477e20bcc5d162708207fb5200f /src/libcore
parent85fb3b6fc0a6698a001ad8b26b26d389645c3507 (diff)
parenta73df6bf24bc6f55cf3d2fa60f397bc7a0cb7024 (diff)
downloadrust-efb5a9a9f03016b8d3d3c13f940bbbfeac2cdfa6.tar.gz
rust-efb5a9a9f03016b8d3d3c13f940bbbfeac2cdfa6.zip
Auto merge of #30640 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #30373, #30502, #30511, #30546, #30556, #30620
- Failed merges:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 526c2e1c6b5..6f052f964c6 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -1113,16 +1113,22 @@ pub trait Iterator {
         Take{iter: self, n: n}
     }
 
-    /// An iterator similar to `fold()`, with internal state.
-    ///
-    /// `scan()` accumulates a final value, similar to [`fold()`], but instead
-    /// of passing along an accumulator, it maintains the accumulator internally.
+    /// An iterator adaptor similar to [`fold()`] that holds internal state and
+    /// produces a new iterator.
     ///
     /// [`fold()`]: #method.fold
     ///
-    /// On each iteraton of `scan()`, you can assign to the internal state, and
-    /// a mutable reference to the state is passed as the first argument to the
-    /// closure, allowing you to modify it on each iteration.
+    /// `scan()` takes two arguments: an initial value which seeds the internal
+    /// state, and a closure with two arguments, the first being a mutable
+    /// reference to the internal state and the second an iterator element.
+    /// The closure can assign to the internal state to share state between
+    /// iterations.
+    ///
+    /// On iteration, the closure will be applied to each element of the
+    /// iterator and the return value from the closure, an [`Option`], is
+    /// yielded by the iterator.
+    ///
+    /// [`Option`]: ../option/enum.Option.html
     ///
     /// # Examples
     ///