Skip to content

Commit 4b45f47

Browse files
author
blake2-ppc
committed
std: Rename Iterator adaptor types to drop the -Iterator suffix
Drop the "Iterator" suffix for the the structs in std::iterator. Filter, Zip, Chain etc. are shorter type names for when iterator pipelines need their types written out in full in return value types, so it's easier to read and write. the iterator module already forms enough namespace.
1 parent 52dbe13 commit 4b45f47

File tree

8 files changed

+111
-112
lines changed

8 files changed

+111
-112
lines changed

src/libextra/dlist.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use std::cast;
2626
use std::ptr;
2727
use std::util;
28-
use std::iterator::{FromIterator, InvertIterator};
28+
use std::iterator::{FromIterator, Invert};
2929

3030
use container::Deque;
3131

@@ -356,7 +356,7 @@ impl<T> DList<T> {
356356

357357
/// Provide a reverse iterator
358358
#[inline]
359-
pub fn rev_iter<'a>(&'a self) -> InvertIterator<DListIterator<'a, T>> {
359+
pub fn rev_iter<'a>(&'a self) -> Invert<DListIterator<'a, T>> {
360360
self.iter().invert()
361361
}
362362

@@ -376,7 +376,7 @@ impl<T> DList<T> {
376376
}
377377
/// Provide a reverse iterator with mutable references
378378
#[inline]
379-
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<MutDListIterator<'a, T>> {
379+
pub fn mut_rev_iter<'a>(&'a mut self) -> Invert<MutDListIterator<'a, T>> {
380380
self.mut_iter().invert()
381381
}
382382

@@ -389,7 +389,7 @@ impl<T> DList<T> {
389389

390390
/// Consume the list into an iterator yielding elements by value, in reverse
391391
#[inline]
392-
pub fn consume_rev_iter(self) -> InvertIterator<ConsumeIterator<T>> {
392+
pub fn consume_rev_iter(self) -> Invert<ConsumeIterator<T>> {
393393
self.consume_iter().invert()
394394
}
395395
}

src/libextra/ringbuf.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use std::num;
1717
use std::uint;
1818
use std::vec;
19-
use std::iterator::{FromIterator, InvertIterator};
19+
use std::iterator::{FromIterator, Invert};
2020

2121
use container::Deque;
2222

@@ -181,7 +181,7 @@ impl<T> RingBuf<T> {
181181
}
182182

183183
/// Back-to-front iterator.
184-
pub fn rev_iter<'a>(&'a self) -> InvertIterator<RingBufIterator<'a, T>> {
184+
pub fn rev_iter<'a>(&'a self) -> Invert<RingBufIterator<'a, T>> {
185185
self.iter().invert()
186186
}
187187

@@ -192,7 +192,7 @@ impl<T> RingBuf<T> {
192192
}
193193

194194
/// Back-to-front iterator which returns mutable values.
195-
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<RingBufMutIterator<'a, T>> {
195+
pub fn mut_rev_iter<'a>(&'a mut self) -> Invert<RingBufMutIterator<'a, T>> {
196196
self.mut_iter().invert()
197197
}
198198
}

src/libextra/smallintmap.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#[allow(missing_doc)];
1717

18-
use std::iterator::{Iterator, IteratorUtil, EnumerateIterator, FilterMapIterator, InvertIterator};
18+
use std::iterator::{Iterator, IteratorUtil, Enumerate, FilterMap, Invert};
1919
use std::uint;
2020
use std::util::replace;
2121
use std::vec::{VecIterator, VecMutIterator};
@@ -204,8 +204,8 @@ impl<V> SmallIntMap<V> {
204204

205205
/// Empties the hash map, moving all values into the specified closure
206206
pub fn consume(&mut self)
207-
-> FilterMapIterator<(uint, Option<V>), (uint, V),
208-
EnumerateIterator<vec::ConsumeIterator<Option<V>>>>
207+
-> FilterMap<(uint, Option<V>), (uint, V),
208+
Enumerate<vec::ConsumeIterator<Option<V>>>>
209209
{
210210
let values = replace(&mut self.v, ~[]);
211211
values.consume_iter().enumerate().filter_map(|(i, v)| {
@@ -291,7 +291,7 @@ pub struct SmallIntMapIterator<'self, T> {
291291

292292
iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
293293
double_ended_iterator!(impl SmallIntMapIterator -> (uint, &'self T), get_ref)
294-
pub type SmallIntMapRevIterator<'self, T> = InvertIterator<SmallIntMapIterator<'self, T>>;
294+
pub type SmallIntMapRevIterator<'self, T> = Invert<SmallIntMapIterator<'self, T>>;
295295

296296
pub struct SmallIntMapMutIterator<'self, T> {
297297
priv front: uint,
@@ -301,7 +301,7 @@ pub struct SmallIntMapMutIterator<'self, T> {
301301

302302
iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
303303
double_ended_iterator!(impl SmallIntMapMutIterator -> (uint, &'self mut T), get_mut_ref)
304-
pub type SmallIntMapMutRevIterator<'self, T> = InvertIterator<SmallIntMapMutIterator<'self, T>>;
304+
pub type SmallIntMapMutRevIterator<'self, T> = Invert<SmallIntMapMutIterator<'self, T>>;
305305

306306
#[cfg(test)]
307307
mod test_map {

src/libstd/hashmap.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
1919
use clone::Clone;
2020
use cmp::{Eq, Equiv};
2121
use hash::Hash;
22-
use iterator::{Iterator, IteratorUtil, FromIterator, ChainIterator};
22+
use iterator::{Iterator, IteratorUtil, FromIterator, Chain};
2323
use num;
2424
use option::{None, Option, Some};
2525
use rand::RngUtil;
@@ -751,7 +751,7 @@ impl<T:Hash + Eq> HashSet<T> {
751751

752752
/// Visit the values representing the symmetric difference
753753
pub fn symmetric_difference_iter<'a>(&'a self, other: &'a HashSet<T>)
754-
-> ChainIterator<SetAlgebraIter<'a, T>, SetAlgebraIter<'a, T>> {
754+
-> Chain<SetAlgebraIter<'a, T>, SetAlgebraIter<'a, T>> {
755755
self.difference_iter(other).chain_(other.difference_iter(self))
756756
}
757757

@@ -764,7 +764,7 @@ impl<T:Hash + Eq> HashSet<T> {
764764

765765
/// Visit the values representing the union
766766
pub fn union_iter<'a>(&'a self, other: &'a HashSet<T>)
767-
-> ChainIterator<HashSetIterator<'a, T>, SetAlgebraIter<'a, T>> {
767+
-> Chain<HashSetIterator<'a, T>, SetAlgebraIter<'a, T>> {
768768
self.iter().chain_(other.difference_iter(self))
769769
}
770770

0 commit comments

Comments
 (0)