File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
branches/snap-stage3/src/libcore Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 14192d6df5cc714e5c9a3ca70b08f2514d977be2
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: e2fd2dffde52a59f7d59d67460aeb2ebf33f77dd
4
+ refs/heads/snap-stage3: 9f9e2516b41a63c4500f7cff1148de3ba05cc5cd
5
5
refs/heads/try: 961e0358e1a5c0faaef606e31e9965742c1643bf
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
Original file line number Diff line number Diff line change @@ -244,6 +244,20 @@ pub trait IteratorExt: Iterator + Sized {
244
244
/// assert_eq!(it.next().unwrap(), (&0, &1));
245
245
/// assert!(it.next().is_none());
246
246
/// ```
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.
247
261
#[ inline]
248
262
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
249
263
fn zip < U : Iterator > ( self , other : U ) -> Zip < Self , U > {
@@ -313,6 +327,9 @@ pub trait IteratorExt: Iterator + Sized {
313
327
/// Creates an iterator that yields a pair of the value returned by this
314
328
/// iterator plus the current index of iteration.
315
329
///
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
+ ///
316
333
/// # Examples
317
334
///
318
335
/// ```
You can’t perform that action at this time.
0 commit comments