Skip to content

Commit 7caaeab

Browse files
committed
---
yaml --- r: 57017 b: refs/heads/try c: d7a2ae6 h: refs/heads/master i: 57015: 016aca4 v: v3
1 parent 91655eb commit 7caaeab

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: ae1c9ebf3c3a0a7e176314f742f533a788ea0dd2
5+
refs/heads/try: d7a2ae6c42f1d9755178485fd93f234c2df8a8fe
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/iterator.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub trait IteratorUtil<A> {
2222
// FIXME: #5898: should be called map
2323
fn transform<'r, B>(self, f: &'r fn(A) -> B) -> MapIterator<'r, A, B, Self>;
2424
fn filter<'r>(self, predicate: &'r fn(&A) -> bool) -> FilterIterator<'r, A, Self>;
25+
fn enumerate(self) -> EnumerateIterator<Self>;
2526
fn skip_while<'r>(self, predicate: &'r fn(&A) -> bool) -> SkipWhileIterator<'r, A, Self>;
2627
fn take_while<'r>(self, predicate: &'r fn(&A) -> bool) -> TakeWhileIterator<'r, A, Self>;
2728
fn skip(self, n: uint) -> SkipIterator<Self>;
2829
fn take(self, n: uint) -> TakeIterator<Self>;
29-
fn enumerate(self) -> EnumerateIterator<Self>;
3030
fn advance(&mut self, f: &fn(A) -> bool);
3131
}
3232

@@ -101,6 +101,21 @@ impl<A, B, T: Iterator<A>, U: Iterator<B>> Iterator<(A, B)> for ZipIterator<T, U
101101
}
102102
}
103103

104+
pub struct MapIterator<'self, A, B, T> {
105+
priv iter: T,
106+
priv f: &'self fn(A) -> B
107+
}
108+
109+
impl<'self, A, B, T: Iterator<A>> Iterator<B> for MapIterator<'self, A, B, T> {
110+
#[inline]
111+
fn next(&mut self) -> Option<B> {
112+
match self.iter.next() {
113+
Some(a) => Some((self.f)(a)),
114+
_ => None
115+
}
116+
}
117+
}
118+
104119
pub struct FilterIterator<'self, A, T> {
105120
priv iter: T,
106121
priv predicate: &'self fn(&A) -> bool
@@ -120,21 +135,6 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for FilterIterator<'self, A, T> {
120135
}
121136
}
122137

123-
pub struct MapIterator<'self, A, B, T> {
124-
priv iter: T,
125-
priv f: &'self fn(A) -> B
126-
}
127-
128-
impl<'self, A, B, T: Iterator<A>> Iterator<B> for MapIterator<'self, A, B, T> {
129-
#[inline]
130-
fn next(&mut self) -> Option<B> {
131-
match self.iter.next() {
132-
Some(a) => Some((self.f)(a)),
133-
_ => None
134-
}
135-
}
136-
}
137-
138138
pub struct EnumerateIterator<T> {
139139
priv iter: T,
140140
priv count: uint

0 commit comments

Comments
 (0)