Skip to content

Commit 1669a1a

Browse files
committed
---
yaml --- r: 195303 b: refs/heads/snap-stage3 c: 9f9e251 h: refs/heads/master i: 195301: d45744a 195299: 6766c18 195295: c73964b v: v3
1 parent abac55e commit 1669a1a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 14192d6df5cc714e5c9a3ca70b08f2514d977be2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e2fd2dffde52a59f7d59d67460aeb2ebf33f77dd
4+
refs/heads/snap-stage3: 9f9e2516b41a63c4500f7cff1148de3ba05cc5cd
55
refs/heads/try: 961e0358e1a5c0faaef606e31e9965742c1643bf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/libcore/iter.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,20 @@ pub trait IteratorExt: Iterator + Sized {
244244
/// assert_eq!(it.next().unwrap(), (&0, &1));
245245
/// assert!(it.next().is_none());
246246
/// ```
247+
///
248+
/// `zip` can provide similar functionality to `enumerate`:
249+
///
250+
/// ```
251+
/// for pair in "foo".chars().enumerate() {
252+
/// println!("{:?}", pair);
253+
/// }
254+
///
255+
/// for pair in (0..).zip("foo".chars()) {
256+
/// println!("{:?}", pair);
257+
/// }
258+
/// ```
259+
///
260+
/// both produce the same output.
247261
#[inline]
248262
#[stable(feature = "rust1", since = "1.0.0")]
249263
fn zip<U: Iterator>(self, other: U) -> Zip<Self, U> {
@@ -313,6 +327,9 @@ pub trait IteratorExt: Iterator + Sized {
313327
/// Creates an iterator that yields a pair of the value returned by this
314328
/// iterator plus the current index of iteration.
315329
///
330+
/// `enumerate` keeps its count as a `usize`. If you want to count by a
331+
/// different sized integer, the `zip` function provides similar functionality.
332+
///
316333
/// # Examples
317334
///
318335
/// ```

0 commit comments

Comments
 (0)