Skip to content

Commit

Permalink
std: Rename Iterator adaptor types to drop the -Iterator suffix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blake2-ppc committed Jul 29, 2013
1 parent 52dbe13 commit 4b45f47
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 112 deletions.
8 changes: 4 additions & 4 deletions src/libextra/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use std::cast;
use std::ptr;
use std::util;
use std::iterator::{FromIterator, InvertIterator};
use std::iterator::{FromIterator, Invert};

use container::Deque;

Expand Down Expand Up @@ -356,7 +356,7 @@ impl<T> DList<T> {

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

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

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

/// Consume the list into an iterator yielding elements by value, in reverse
#[inline]
pub fn consume_rev_iter(self) -> InvertIterator<ConsumeIterator<T>> {
pub fn consume_rev_iter(self) -> Invert<ConsumeIterator<T>> {
self.consume_iter().invert()
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use std::num;
use std::uint;
use std::vec;
use std::iterator::{FromIterator, InvertIterator};
use std::iterator::{FromIterator, Invert};

use container::Deque;

Expand Down Expand Up @@ -181,7 +181,7 @@ impl<T> RingBuf<T> {
}

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

Expand All @@ -192,7 +192,7 @@ impl<T> RingBuf<T> {
}

/// Back-to-front iterator which returns mutable values.
pub fn mut_rev_iter<'a>(&'a mut self) -> InvertIterator<RingBufMutIterator<'a, T>> {
pub fn mut_rev_iter<'a>(&'a mut self) -> Invert<RingBufMutIterator<'a, T>> {
self.mut_iter().invert()
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/libextra/smallintmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#[allow(missing_doc)];

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

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

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

pub struct SmallIntMapMutIterator<'self, T> {
priv front: uint,
Expand All @@ -301,7 +301,7 @@ pub struct SmallIntMapMutIterator<'self, T> {

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

#[cfg(test)]
mod test_map {
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/hashmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
use clone::Clone;
use cmp::{Eq, Equiv};
use hash::Hash;
use iterator::{Iterator, IteratorUtil, FromIterator, ChainIterator};
use iterator::{Iterator, IteratorUtil, FromIterator, Chain};
use num;
use option::{None, Option, Some};
use rand::RngUtil;
Expand Down Expand Up @@ -751,7 +751,7 @@ impl<T:Hash + Eq> HashSet<T> {

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

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

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

Expand Down
Loading

5 comments on commit 4b45f47

@bors
Copy link
Contributor

@bors bors commented on 4b45f47 Jul 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 4b45f47 Jul 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging blake2-ppc/rust/iterator-adaptor-names = 4b45f47 into auto

@bors
Copy link
Contributor

@bors bors commented on 4b45f47 Jul 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blake2-ppc/rust/iterator-adaptor-names = 4b45f47 merged ok, testing candidate = bb996bf

@bors
Copy link
Contributor

@bors bors commented on 4b45f47 Jul 30, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = bb996bf

Please sign in to comment.