From 3fd8c8b3306ae33bdc85811aa410ba01967922bc Mon Sep 17 00:00:00 2001 From: Palmer Cox Date: Tue, 14 Jan 2014 22:32:24 -0500 Subject: Rename iterators for consistency Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over. --- src/libstd/c_str.rs | 8 +-- src/libstd/comm/mod.rs | 8 +-- src/libstd/comm/select.rs | 6 +- src/libstd/fmt/mod.rs | 2 +- src/libstd/fmt/parse.rs | 2 +- src/libstd/hashmap.rs | 74 ++++++++++----------- src/libstd/io/extensions.rs | 12 ++-- src/libstd/io/fs.rs | 8 +-- src/libstd/io/mod.rs | 22 +++---- src/libstd/option.rs | 24 +++---- src/libstd/path/mod.rs | 16 ++--- src/libstd/path/posix.rs | 22 +++---- src/libstd/path/windows.rs | 26 ++++---- src/libstd/rt/task.rs | 8 +-- src/libstd/str.rs | 156 ++++++++++++++++++++++---------------------- src/libstd/trie.rs | 54 +++++++-------- src/libstd/vec.rs | 142 ++++++++++++++++++++-------------------- 17 files changed, 295 insertions(+), 295 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index b924378a0e7..301df329f49 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -171,8 +171,8 @@ impl CString { } /// Return a CString iterator. - pub fn iter<'a>(&'a self) -> CStringIterator<'a> { - CStringIterator { + pub fn iter<'a>(&'a self) -> CChars<'a> { + CChars { ptr: self.buf, lifetime: unsafe { cast::transmute(self.buf) }, } @@ -330,12 +330,12 @@ fn check_for_null(v: &[u8], buf: *mut libc::c_char) { /// External iterator for a CString's bytes. /// /// Use with the `std::iter` module. -pub struct CStringIterator<'a> { +pub struct CChars<'a> { priv ptr: *libc::c_char, priv lifetime: &'a libc::c_char, // FIXME: #5922 } -impl<'a> Iterator for CStringIterator<'a> { +impl<'a> Iterator for CChars<'a> { fn next(&mut self) -> Option { let ch = unsafe { *self.ptr }; if ch == 0 { diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index 985a387ee2b..26d67daf7c1 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -305,7 +305,7 @@ pub struct Port { /// An iterator over messages received on a port, this iterator will block /// whenever `next` is called, waiting for a new message, and `None` will be /// returned when the corresponding channel has hung up. -pub struct PortIterator<'a, T> { +pub struct Messages<'a, T> { priv port: &'a Port } @@ -899,12 +899,12 @@ impl Port { /// Returns an iterator which will block waiting for messages, but never /// `fail!`. It will return `None` when the channel has hung up. - pub fn iter<'a>(&'a self) -> PortIterator<'a, T> { - PortIterator { port: self } + pub fn iter<'a>(&'a self) -> Messages<'a, T> { + Messages { port: self } } } -impl<'a, T: Send> Iterator for PortIterator<'a, T> { +impl<'a, T: Send> Iterator for Messages<'a, T> { fn next(&mut self) -> Option { self.port.recv_opt() } } diff --git a/src/libstd/comm/select.rs b/src/libstd/comm/select.rs index fa5ec1d3e30..6a10ac56a4e 100644 --- a/src/libstd/comm/select.rs +++ b/src/libstd/comm/select.rs @@ -94,7 +94,7 @@ pub struct Handle<'port, T> { priv port: &'port mut Port, } -struct PacketIterator { priv cur: *mut Packet } +struct Packets { priv cur: *mut Packet } impl Select { /// Creates a new selection structure. This set is initially empty and @@ -267,7 +267,7 @@ impl Select { (*packet).selection_id = 0; } - fn iter(&self) -> PacketIterator { PacketIterator { cur: self.head } } + fn iter(&self) -> Packets { Packets { cur: self.head } } } impl<'port, T: Send> Handle<'port, T> { @@ -300,7 +300,7 @@ impl<'port, T: Send> Drop for Handle<'port, T> { } } -impl Iterator<*mut Packet> for PacketIterator { +impl Iterator<*mut Packet> for Packets { fn next(&mut self) -> Option<*mut Packet> { if self.cur.is_null() { None diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs index a075010bfb2..8a945d09bfc 100644 --- a/src/libstd/fmt/mod.rs +++ b/src/libstd/fmt/mod.rs @@ -497,7 +497,7 @@ pub struct Formatter<'a> { /// Output buffer. buf: &'a mut io::Writer, - priv curarg: vec::VecIterator<'a, Argument<'a>>, + priv curarg: vec::Items<'a, Argument<'a>>, priv args: &'a [Argument<'a>], } diff --git a/src/libstd/fmt/parse.rs b/src/libstd/fmt/parse.rs index 0ac1aac2380..6c08eae7474 100644 --- a/src/libstd/fmt/parse.rs +++ b/src/libstd/fmt/parse.rs @@ -168,7 +168,7 @@ pub struct SelectArm<'a> { /// necessary there's probably lots of room for improvement performance-wise. pub struct Parser<'a> { priv input: &'a str, - priv cur: str::CharOffsetIterator<'a>, + priv cur: str::CharOffsets<'a>, priv depth: uint, } diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs index 5c3b18caa06..7f19105cdc8 100644 --- a/src/libstd/hashmap.rs +++ b/src/libstd/hashmap.rs @@ -528,34 +528,34 @@ impl HashMap { /// An iterator visiting all keys in arbitrary order. /// Iterator element type is &'a K. - pub fn keys<'a>(&'a self) -> HashMapKeyIterator<'a, K, V> { + pub fn keys<'a>(&'a self) -> Keys<'a, K, V> { self.iter().map(|(k, _v)| k) } /// An iterator visiting all values in arbitrary order. /// Iterator element type is &'a V. - pub fn values<'a>(&'a self) -> HashMapValueIterator<'a, K, V> { + pub fn values<'a>(&'a self) -> Values<'a, K, V> { self.iter().map(|(_k, v)| v) } /// An iterator visiting all key-value pairs in arbitrary order. /// Iterator element type is (&'a K, &'a V). - pub fn iter<'a>(&'a self) -> HashMapIterator<'a, K, V> { - HashMapIterator { iter: self.buckets.iter() } + pub fn iter<'a>(&'a self) -> Entries<'a, K, V> { + Entries { iter: self.buckets.iter() } } /// An iterator visiting all key-value pairs in arbitrary order, /// with mutable references to the values. /// Iterator element type is (&'a K, &'a mut V). - pub fn mut_iter<'a>(&'a mut self) -> HashMapMutIterator<'a, K, V> { - HashMapMutIterator { iter: self.buckets.mut_iter() } + pub fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, K, V> { + MutEntries { iter: self.buckets.mut_iter() } } /// Creates a consuming iterator, that is, one that moves each key-value /// pair out of the map in arbitrary order. The map cannot be used after /// calling this. - pub fn move_iter(self) -> HashMapMoveIterator { - HashMapMoveIterator {iter: self.buckets.move_iter()} + pub fn move_iter(self) -> MoveEntries { + MoveEntries {iter: self.buckets.move_iter()} } } @@ -598,40 +598,40 @@ impl Clone for HashMap { /// HashMap iterator #[deriving(Clone)] -pub struct HashMapIterator<'a, K, V> { - priv iter: vec::VecIterator<'a, Option>>, +pub struct Entries<'a, K, V> { + priv iter: vec::Items<'a, Option>>, } /// HashMap mutable values iterator -pub struct HashMapMutIterator<'a, K, V> { - priv iter: vec::VecMutIterator<'a, Option>>, +pub struct MutEntries<'a, K, V> { + priv iter: vec::MutItems<'a, Option>>, } /// HashMap move iterator -pub struct HashMapMoveIterator { - priv iter: vec::MoveIterator>>, +pub struct MoveEntries { + priv iter: vec::MoveItems>>, } /// HashMap keys iterator -pub type HashMapKeyIterator<'a, K, V> = - iter::Map<'static, (&'a K, &'a V), &'a K, HashMapIterator<'a, K, V>>; +pub type Keys<'a, K, V> = + iter::Map<'static, (&'a K, &'a V), &'a K, Entries<'a, K, V>>; /// HashMap values iterator -pub type HashMapValueIterator<'a, K, V> = - iter::Map<'static, (&'a K, &'a V), &'a V, HashMapIterator<'a, K, V>>; +pub type Values<'a, K, V> = + iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>; /// HashSet iterator #[deriving(Clone)] -pub struct HashSetIterator<'a, K> { - priv iter: vec::VecIterator<'a, Option>>, +pub struct SetItems<'a, K> { + priv iter: vec::Items<'a, Option>>, } /// HashSet move iterator -pub struct HashSetMoveIterator { - priv iter: vec::MoveIterator>>, +pub struct SetMoveItems { + priv iter: vec::MoveItems>>, } -impl<'a, K, V> Iterator<(&'a K, &'a V)> for HashMapIterator<'a, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> { #[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { for elt in self.iter { @@ -644,7 +644,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for HashMapIterator<'a, K, V> { } } -impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for HashMapMutIterator<'a, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> { #[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { for elt in self.iter { @@ -657,7 +657,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for HashMapMutIterator<'a, K, V> { } } -impl Iterator<(K, V)> for HashMapMoveIterator { +impl Iterator<(K, V)> for MoveEntries { #[inline] fn next(&mut self) -> Option<(K, V)> { for elt in self.iter { @@ -670,7 +670,7 @@ impl Iterator<(K, V)> for HashMapMoveIterator { } } -impl<'a, K> Iterator<&'a K> for HashSetIterator<'a, K> { +impl<'a, K> Iterator<&'a K> for SetItems<'a, K> { #[inline] fn next(&mut self) -> Option<&'a K> { for elt in self.iter { @@ -683,7 +683,7 @@ impl<'a, K> Iterator<&'a K> for HashSetIterator<'a, K> { } } -impl Iterator for HashSetMoveIterator { +impl Iterator for SetMoveItems { #[inline] fn next(&mut self) -> Option { for elt in self.iter { @@ -806,19 +806,19 @@ impl HashSet { /// An iterator visiting all elements in arbitrary order. /// Iterator element type is &'a T. - pub fn iter<'a>(&'a self) -> HashSetIterator<'a, T> { - HashSetIterator { iter: self.map.buckets.iter() } + pub fn iter<'a>(&'a self) -> SetItems<'a, T> { + SetItems { iter: self.map.buckets.iter() } } /// Creates a consuming iterator, that is, one that moves each value out /// of the set in arbitrary order. The set cannot be used after calling /// this. - pub fn move_iter(self) -> HashSetMoveIterator { - HashSetMoveIterator {iter: self.map.buckets.move_iter()} + pub fn move_iter(self) -> SetMoveItems { + SetMoveItems {iter: self.map.buckets.move_iter()} } /// Visit the values representing the difference - pub fn difference<'a>(&'a self, other: &'a HashSet) -> SetAlgebraIter<'a, T> { + pub fn difference<'a>(&'a self, other: &'a HashSet) -> SetAlgebraItems<'a, T> { Repeat::new(other) .zip(self.iter()) .filter_map(|(other, elt)| { @@ -828,13 +828,13 @@ impl HashSet { /// Visit the values representing the symmetric difference pub fn symmetric_difference<'a>(&'a self, other: &'a HashSet) - -> Chain, SetAlgebraIter<'a, T>> { + -> Chain, SetAlgebraItems<'a, T>> { self.difference(other).chain(other.difference(self)) } /// Visit the values representing the intersection pub fn intersection<'a>(&'a self, other: &'a HashSet) - -> SetAlgebraIter<'a, T> { + -> SetAlgebraItems<'a, T> { Repeat::new(other) .zip(self.iter()) .filter_map(|(other, elt)| { @@ -844,7 +844,7 @@ impl HashSet { /// Visit the values representing the union pub fn union<'a>(&'a self, other: &'a HashSet) - -> Chain, SetAlgebraIter<'a, T>> { + -> Chain, SetAlgebraItems<'a, T>> { self.iter().chain(other.difference(self)) } @@ -882,9 +882,9 @@ impl Default for HashSet { // `Repeat` is used to feed the filter closure an explicit capture // of a reference to the other set /// Set operations iterator -pub type SetAlgebraIter<'a, T> = +pub type SetAlgebraItems<'a, T> = FilterMap<'static,(&'a HashSet, &'a T), &'a T, - Zip>,HashSetIterator<'a,T>>>; + Zip>,SetItems<'a,T>>>; #[cfg(test)] diff --git a/src/libstd/io/extensions.rs b/src/libstd/io/extensions.rs index cc0cb6b3446..511462f89f8 100644 --- a/src/libstd/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -24,7 +24,7 @@ use vec::{OwnedVector, ImmutableVector}; /// /// # Notes about the Iteration Protocol /// -/// The `ByteIterator` may yield `None` and thus terminate +/// The `Bytes` may yield `None` and thus terminate /// an iteration, but continue to yield elements if iteration /// is attempted again. /// @@ -33,17 +33,17 @@ use vec::{OwnedVector, ImmutableVector}; /// Raises the same conditions as the `read` method, for /// each call to its `.next()` method. /// Yields `None` if the condition is handled. -pub struct ByteIterator<'r, T> { +pub struct Bytes<'r, T> { priv reader: &'r mut T, } -impl<'r, R: Reader> ByteIterator<'r, R> { - pub fn new(r: &'r mut R) -> ByteIterator<'r, R> { - ByteIterator { reader: r } +impl<'r, R: Reader> Bytes<'r, R> { + pub fn new(r: &'r mut R) -> Bytes<'r, R> { + Bytes { reader: r } } } -impl<'r, R: Reader> Iterator for ByteIterator<'r, R> { +impl<'r, R: Reader> Iterator for Bytes<'r, R> { #[inline] fn next(&mut self) -> Option { self.reader.read_byte() diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index a3f84fe2afa..aac565f2c45 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -508,16 +508,16 @@ pub fn readdir(path: &Path) -> ~[Path] { /// Returns an iterator which will recursively walk the directory structure /// rooted at `path`. The path given will not be iterated over, and this will /// perform iteration in a top-down order. -pub fn walk_dir(path: &Path) -> WalkIterator { - WalkIterator { stack: readdir(path) } +pub fn walk_dir(path: &Path) -> Directories { + Directories { stack: readdir(path) } } /// An iterator which walks over a directory -pub struct WalkIterator { +pub struct Directories { priv stack: ~[Path], } -impl Iterator for WalkIterator { +impl Iterator for Directories { fn next(&mut self) -> Option { match self.stack.shift_opt() { Some(path) => { diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 41cce58d9d5..87180980541 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -624,8 +624,8 @@ pub trait Reader { /// Raises the same conditions as the `read` method, for /// each call to its `.next()` method. /// Ends the iteration if the condition is handled. - fn bytes<'r>(&'r mut self) -> extensions::ByteIterator<'r, Self> { - extensions::ByteIterator::new(self) + fn bytes<'r>(&'r mut self) -> extensions::Bytes<'r, Self> { + extensions::Bytes::new(self) } // Byte conversion helpers @@ -1053,7 +1053,7 @@ impl Stream for T {} /// /// # Notes about the Iteration Protocol /// -/// The `LineIterator` may yield `None` and thus terminate +/// The `Lines` may yield `None` and thus terminate /// an iteration, but continue to yield elements if iteration /// is attempted again. /// @@ -1062,11 +1062,11 @@ impl Stream for T {} /// Raises the same conditions as the `read` method except for `EndOfFile` /// which is swallowed. /// Iteration yields `None` if the condition is handled. -pub struct LineIterator<'r, T> { +pub struct Lines<'r, T> { priv buffer: &'r mut T, } -impl<'r, T: Buffer> Iterator<~str> for LineIterator<'r, T> { +impl<'r, T: Buffer> Iterator<~str> for Lines<'r, T> { fn next(&mut self) -> Option<~str> { self.buffer.read_line() } @@ -1126,8 +1126,8 @@ pub trait Buffer: Reader { /// /// Iterator raises the same conditions as the `read` method /// except for `EndOfFile`. - fn lines<'r>(&'r mut self) -> LineIterator<'r, Self> { - LineIterator { + fn lines<'r>(&'r mut self) -> Lines<'r, Self> { + Lines { buffer: self, } } @@ -1256,8 +1256,8 @@ pub trait Acceptor { fn accept(&mut self) -> Option; /// Create an iterator over incoming connection attempts - fn incoming<'r>(&'r mut self) -> IncomingIterator<'r, Self> { - IncomingIterator { inc: self } + fn incoming<'r>(&'r mut self) -> IncomingConnections<'r, Self> { + IncomingConnections { inc: self } } } @@ -1268,11 +1268,11 @@ pub trait Acceptor { /// The Some contains another Option representing whether the connection attempt was succesful. /// A successful connection will be wrapped in Some. /// A failed connection is represented as a None and raises a condition. -struct IncomingIterator<'a, A> { +struct IncomingConnections<'a, A> { priv inc: &'a mut A, } -impl<'a, T, A: Acceptor> Iterator> for IncomingIterator<'a, A> { +impl<'a, T, A: Acceptor> Iterator> for IncomingConnections<'a, A> { fn next(&mut self) -> Option> { Some(self.inc.accept()) } diff --git a/src/libstd/option.rs b/src/libstd/option.rs index aab98f19e15..621b1a3d1e2 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -214,26 +214,26 @@ impl Option { /// Return an iterator over the possibly contained value #[inline] - pub fn iter<'r>(&'r self) -> OptionIterator<&'r T> { + pub fn iter<'r>(&'r self) -> Item<&'r T> { match *self { - Some(ref x) => OptionIterator{opt: Some(x)}, - None => OptionIterator{opt: None} + Some(ref x) => Item{opt: Some(x)}, + None => Item{opt: None} } } /// Return a mutable iterator over the possibly contained value #[inline] - pub fn mut_iter<'r>(&'r mut self) -> OptionIterator<&'r mut T> { + pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> { match *self { - Some(ref mut x) => OptionIterator{opt: Some(x)}, - None => OptionIterator{opt: None} + Some(ref mut x) => Item{opt: Some(x)}, + None => Item{opt: None} } } /// Return a consuming iterator over the possibly contained value #[inline] - pub fn move_iter(self) -> OptionIterator { - OptionIterator{opt: self} + pub fn move_iter(self) -> Item { + Item{opt: self} } ///////////////////////////////////////////////////////////////////////// @@ -401,11 +401,11 @@ impl Default for Option { /// An iterator that yields either one or zero elements #[deriving(Clone, DeepClone)] -pub struct OptionIterator { +pub struct Item { priv opt: Option } -impl Iterator for OptionIterator { +impl Iterator for Item { #[inline] fn next(&mut self) -> Option { self.opt.take() @@ -420,14 +420,14 @@ impl Iterator for OptionIterator { } } -impl DoubleEndedIterator for OptionIterator { +impl DoubleEndedIterator for Item { #[inline] fn next_back(&mut self) -> Option { self.opt.take() } } -impl ExactSize for OptionIterator {} +impl ExactSize for Item {} ///////////////////////////////////////////////////////////////////////////// // Free functions diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 354cc10f022..56e86afaaef 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -93,29 +93,29 @@ pub use Path = self::windows::Path; /// Typedef for the platform-native component iterator #[cfg(unix)] -pub use ComponentIter = self::posix::ComponentIter; +pub use Components = self::posix::Components; /// Typedef for the platform-native reverse component iterator #[cfg(unix)] -pub use RevComponentIter = self::posix::RevComponentIter; +pub use RevComponents = self::posix::RevComponents; /// Typedef for the platform-native component iterator #[cfg(windows)] -pub use ComponentIter = self::windows::ComponentIter; +pub use Components = self::windows::Components; /// Typedef for the platform-native reverse component iterator #[cfg(windows)] -pub use RevComponentIter = self::windows::RevComponentIter; +pub use RevComponents = self::windows::RevComponents; /// Typedef for the platform-native str component iterator #[cfg(unix)] -pub use StrComponentIter = self::posix::StrComponentIter; +pub use StrComponents = self::posix::StrComponents; /// Typedef for the platform-native reverse str component iterator #[cfg(unix)] -pub use RevStrComponentIter = self::posix::RevStrComponentIter; +pub use RevStrComponents = self::posix::RevStrComponents; /// Typedef for the platform-native str component iterator #[cfg(windows)] -pub use StrComponentIter = self::windows::StrComponentIter; +pub use StrComponents = self::windows::StrComponents; /// Typedef for the platform-native reverse str component iterator #[cfg(windows)] -pub use RevStrComponentIter = self::windows::RevStrComponentIter; +pub use RevStrComponents = self::windows::RevStrComponents; /// Typedef for the platform-native separator char func #[cfg(unix)] diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index e2ddabc1714..0a93f385a06 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -21,21 +21,21 @@ use str; use str::Str; use to_bytes::IterBytes; use vec; -use vec::{CopyableVector, RSplitIterator, SplitIterator, Vector, VectorVector, +use vec::{CopyableVector, RevSplits, Splits, Vector, VectorVector, ImmutableEqVector, OwnedVector, ImmutableVector, OwnedCopyableVector}; use super::{BytesContainer, GenericPath, GenericPathUnsafe}; /// Iterator that yields successive components of a Path as &[u8] -pub type ComponentIter<'a> = SplitIterator<'a, u8>; +pub type Components<'a> = Splits<'a, u8>; /// Iterator that yields components of a Path in reverse as &[u8] -pub type RevComponentIter<'a> = RSplitIterator<'a, u8>; +pub type RevComponents<'a> = RevSplits<'a, u8>; /// Iterator that yields successive components of a Path as Option<&str> -pub type StrComponentIter<'a> = Map<'a, &'a [u8], Option<&'a str>, - ComponentIter<'a>>; +pub type StrComponents<'a> = Map<'a, &'a [u8], Option<&'a str>, + Components<'a>>; /// Iterator that yields components of a Path in reverse as Option<&str> -pub type RevStrComponentIter<'a> = Map<'a, &'a [u8], Option<&'a str>, - RevComponentIter<'a>>; +pub type RevStrComponents<'a> = Map<'a, &'a [u8], Option<&'a str>, + RevComponents<'a>>; /// Represents a POSIX file path #[deriving(Clone, DeepClone)] @@ -371,7 +371,7 @@ impl Path { /// Does not distinguish between absolute and relative paths, e.g. /// /a/b/c and a/b/c yield the same set of components. /// A path of "/" yields no components. A path of "." yields one component. - pub fn components<'a>(&'a self) -> ComponentIter<'a> { + pub fn components<'a>(&'a self) -> Components<'a> { let v = if self.repr[0] == sep_byte { self.repr.slice_from(1) } else { self.repr.as_slice() }; @@ -385,7 +385,7 @@ impl Path { /// Returns an iterator that yields each component of the path in reverse. /// See components() for details. - pub fn rev_components<'a>(&'a self) -> RevComponentIter<'a> { + pub fn rev_components<'a>(&'a self) -> RevComponents<'a> { let v = if self.repr[0] == sep_byte { self.repr.slice_from(1) } else { self.repr.as_slice() }; @@ -399,13 +399,13 @@ impl Path { /// Returns an iterator that yields each component of the path as Option<&str>. /// See components() for details. - pub fn str_components<'a>(&'a self) -> StrComponentIter<'a> { + pub fn str_components<'a>(&'a self) -> StrComponents<'a> { self.components().map(str::from_utf8_opt) } /// Returns an iterator that yields each component of the path in reverse as Option<&str>. /// See components() for details. - pub fn rev_str_components<'a>(&'a self) -> RevStrComponentIter<'a> { + pub fn rev_str_components<'a>(&'a self) -> RevStrComponents<'a> { self.rev_components().map(str::from_utf8_opt) } } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index a42fdabef88..9b0169bf22d 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -20,7 +20,7 @@ use from_str::FromStr; use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Invert, Iterator, Map}; use option::{Option, Some, None}; use str; -use str::{CharSplitIterator, OwnedStr, Str, StrVector, StrSlice}; +use str::{CharSplits, OwnedStr, Str, StrVector, StrSlice}; use to_bytes::IterBytes; use vec::{Vector, OwnedVector, ImmutableVector}; use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe}; @@ -29,21 +29,21 @@ use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe}; /// /// Each component is yielded as Option<&str> for compatibility with PosixPath, but /// every component in WindowsPath is guaranteed to be Some. -pub type StrComponentIter<'a> = Map<'a, &'a str, Option<&'a str>, - CharSplitIterator<'a, char>>; +pub type StrComponents<'a> = Map<'a, &'a str, Option<&'a str>, + CharSplits<'a, char>>; /// Iterator that yields components of a Path in reverse as &str /// /// Each component is yielded as Option<&str> for compatibility with PosixPath, but /// every component in WindowsPath is guaranteed to be Some. -pub type RevStrComponentIter<'a> = Invert, - CharSplitIterator<'a, char>>>; +pub type RevStrComponents<'a> = Invert, + CharSplits<'a, char>>>; /// Iterator that yields successive components of a Path as &[u8] -pub type ComponentIter<'a> = Map<'a, Option<&'a str>, &'a [u8], - StrComponentIter<'a>>; +pub type Components<'a> = Map<'a, Option<&'a str>, &'a [u8], + StrComponents<'a>>; /// Iterator that yields components of a Path in reverse as &[u8] -pub type RevComponentIter<'a> = Map<'a, Option<&'a str>, &'a [u8], - RevStrComponentIter<'a>>; +pub type RevComponents<'a> = Map<'a, Option<&'a str>, &'a [u8], + RevStrComponents<'a>>; /// Represents a Windows path // Notes for Windows path impl: @@ -615,7 +615,7 @@ impl Path { /// \a\b\c and a\b\c. /// Does not distinguish between absolute and cwd-relative paths, e.g. /// C:\foo and C:foo. - pub fn str_components<'a>(&'a self) -> StrComponentIter<'a> { + pub fn str_components<'a>(&'a self) -> StrComponents<'a> { let s = match self.prefix { Some(_) => { let plen = self.prefix_len(); @@ -632,13 +632,13 @@ impl Path { /// Returns an iterator that yields each component of the path in reverse as an Option<&str> /// See str_components() for details. - pub fn rev_str_components<'a>(&'a self) -> RevStrComponentIter<'a> { + pub fn rev_str_components<'a>(&'a self) -> RevStrComponents<'a> { self.str_components().invert() } /// Returns an iterator that yields each component of the path in turn as a &[u8]. /// See str_components() for details. - pub fn components<'a>(&'a self) -> ComponentIter<'a> { + pub fn components<'a>(&'a self) -> Components<'a> { fn convert<'a>(x: Option<&'a str>) -> &'a [u8] { #[inline]; x.unwrap().as_bytes() @@ -648,7 +648,7 @@ impl Path { /// Returns an iterator that yields each component of the path in reverse as a &[u8]. /// See str_components() for details. - pub fn rev_components<'a>(&'a self) -> RevComponentIter<'a> { + pub fn rev_components<'a>(&'a self) -> RevComponents<'a> { fn convert<'a>(x: Option<&'a str>) -> &'a [u8] { #[inline]; x.unwrap().as_bytes() diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 4df626446c4..5041c4b6165 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -79,7 +79,7 @@ pub struct Death { on_exit: Option, } -pub struct BlockedTaskIterator { +pub struct BlockedTasks { priv inner: UnsafeArc, } @@ -300,7 +300,7 @@ impl Drop for Task { } } -impl Iterator for BlockedTaskIterator { +impl Iterator for BlockedTasks { fn next(&mut self) -> Option { Some(Shared(self.inner.clone())) } @@ -331,7 +331,7 @@ impl BlockedTask { } /// Converts one blocked task handle to a list of many handles to the same. - pub fn make_selectable(self, num_handles: uint) -> Take + pub fn make_selectable(self, num_handles: uint) -> Take { let arc = match self { Owned(task) => { @@ -340,7 +340,7 @@ impl BlockedTask { } Shared(arc) => arc.clone(), }; - BlockedTaskIterator{ inner: arc }.take(num_handles) + BlockedTasks{ inner: arc }.take(num_handles) } /// Convert to an unsafe uint value. Useful for storing in a pipe's state diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 8b6e1520dc7..fdc9c11d93a 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -331,12 +331,12 @@ Section: Iterators /// External iterator for a string's characters. /// Use with the `std::iter` module. #[deriving(Clone)] -pub struct CharIterator<'a> { +pub struct Chars<'a> { /// The slice remaining to be iterated priv string: &'a str, } -impl<'a> Iterator for CharIterator<'a> { +impl<'a> Iterator for Chars<'a> { #[inline] fn next(&mut self) -> Option { // Decode the next codepoint, then update @@ -358,7 +358,7 @@ impl<'a> Iterator for CharIterator<'a> { } } -impl<'a> DoubleEndedIterator for CharIterator<'a> { +impl<'a> DoubleEndedIterator for Chars<'a> { #[inline] fn next_back(&mut self) -> Option { if self.string.len() != 0 { @@ -376,13 +376,13 @@ impl<'a> DoubleEndedIterator for CharIterator<'a> { /// External iterator for a string's characters and their byte offsets. /// Use with the `std::iter` module. #[deriving(Clone)] -pub struct CharOffsetIterator<'a> { +pub struct CharOffsets<'a> { /// The original string to be iterated priv string: &'a str, - priv iter: CharIterator<'a>, + priv iter: Chars<'a>, } -impl<'a> Iterator<(uint, char)> for CharOffsetIterator<'a> { +impl<'a> Iterator<(uint, char)> for CharOffsets<'a> { #[inline] fn next(&mut self) -> Option<(uint, char)> { // Compute the byte offset by using the pointer offset between @@ -397,7 +397,7 @@ impl<'a> Iterator<(uint, char)> for CharOffsetIterator<'a> { } } -impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsetIterator<'a> { +impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsets<'a> { #[inline] fn next_back(&mut self) -> Option<(uint, char)> { self.iter.next_back().map(|ch| { @@ -410,24 +410,24 @@ impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsetIterator<'a> { /// External iterator for a string's characters in reverse order. /// Use with the `std::iter` module. -pub type CharRevIterator<'a> = Invert>; +pub type RevChars<'a> = Invert>; /// External iterator for a string's characters and their byte offsets in reverse order. /// Use with the `std::iter` module. -pub type CharOffsetRevIterator<'a> = Invert>; +pub type RevCharOffsets<'a> = Invert>; /// External iterator for a string's bytes. /// Use with the `std::iter` module. -pub type ByteIterator<'a> = - Map<'a, &'a u8, u8, vec::VecIterator<'a, u8>>; +pub type Bytes<'a> = + Map<'a, &'a u8, u8, vec::Items<'a, u8>>; /// External iterator for a string's bytes in reverse order. /// Use with the `std::iter` module. -pub type ByteRevIterator<'a> = Invert>; +pub type RevBytes<'a> = Invert>; /// An iterator over the substrings of a string, separated by `sep`. #[deriving(Clone)] -pub struct CharSplitIterator<'a, Sep> { +pub struct CharSplits<'a, Sep> { /// The slice remaining to be iterated priv string: &'a str, priv sep: Sep, @@ -439,27 +439,27 @@ pub struct CharSplitIterator<'a, Sep> { /// An iterator over the substrings of a string, separated by `sep`, /// starting from the back of the string. -pub type CharRSplitIterator<'a, Sep> = Invert>; +pub type RevCharSplits<'a, Sep> = Invert>; /// An iterator over the substrings of a string, separated by `sep`, /// splitting at most `count` times. #[deriving(Clone)] -pub struct CharSplitNIterator<'a, Sep> { - priv iter: CharSplitIterator<'a, Sep>, +pub struct CharSplitsN<'a, Sep> { + priv iter: CharSplits<'a, Sep>, /// The number of splits remaining priv count: uint, priv invert: bool, } /// An iterator over the words of a string, separated by an sequence of whitespace -pub type WordIterator<'a> = - Filter<'a, &'a str, CharSplitIterator<'a, extern "Rust" fn(char) -> bool>>; +pub type Words<'a> = + Filter<'a, &'a str, CharSplits<'a, extern "Rust" fn(char) -> bool>>; /// An iterator over the lines of a string, separated by either `\n` or (`\r\n`). -pub type AnyLineIterator<'a> = - Map<'a, &'a str, &'a str, CharSplitIterator<'a, char>>; +pub type AnyLines<'a> = + Map<'a, &'a str, &'a str, CharSplits<'a, char>>; -impl<'a, Sep> CharSplitIterator<'a, Sep> { +impl<'a, Sep> CharSplits<'a, Sep> { #[inline] fn get_end(&mut self) -> Option<&'a str> { if !self.finished && (self.allow_trailing_empty || self.string.len() > 0) { @@ -471,7 +471,7 @@ impl<'a, Sep> CharSplitIterator<'a, Sep> { } } -impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitIterator<'a, Sep> { +impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplits<'a, Sep> { #[inline] fn next(&mut self) -> Option<&'a str> { if self.finished { return None } @@ -504,7 +504,7 @@ impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitIterator<'a, Sep> { } impl<'a, Sep: CharEq> DoubleEndedIterator<&'a str> -for CharSplitIterator<'a, Sep> { +for CharSplits<'a, Sep> { #[inline] fn next_back(&mut self) -> Option<&'a str> { if self.finished { return None } @@ -545,7 +545,7 @@ for CharSplitIterator<'a, Sep> { } } -impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitNIterator<'a, Sep> { +impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitsN<'a, Sep> { #[inline] fn next(&mut self) -> Option<&'a str> { if self.count != 0 { @@ -560,7 +560,7 @@ impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitNIterator<'a, Sep> { /// An iterator over the start and end indices of the matches of a /// substring within a larger string #[deriving(Clone)] -pub struct MatchesIndexIterator<'a> { +pub struct MatchIndices<'a> { priv haystack: &'a str, priv needle: &'a str, priv position: uint, @@ -569,13 +569,13 @@ pub struct MatchesIndexIterator<'a> { /// An iterator over the substrings of a string separated by a given /// search string #[deriving(Clone)] -pub struct StrSplitIterator<'a> { - priv it: MatchesIndexIterator<'a>, +pub struct StrSplits<'a> { + priv it: MatchIndices<'a>, priv last_end: uint, priv finished: bool } -impl<'a> Iterator<(uint, uint)> for MatchesIndexIterator<'a> { +impl<'a> Iterator<(uint, uint)> for MatchIndices<'a> { #[inline] fn next(&mut self) -> Option<(uint, uint)> { // See Issue #1932 for why this is a naive search @@ -606,7 +606,7 @@ impl<'a> Iterator<(uint, uint)> for MatchesIndexIterator<'a> { } } -impl<'a> Iterator<&'a str> for StrSplitIterator<'a> { +impl<'a> Iterator<&'a str> for StrSplits<'a> { #[inline] fn next(&mut self) -> Option<&'a str> { if self.finished { return None; } @@ -654,14 +654,14 @@ enum NormalizationForm { /// External iterator for a string's normalization's characters. /// Use with the `std::iter` module. #[deriving(Clone)] -struct NormalizationIterator<'a> { +struct Normalizations<'a> { priv kind: NormalizationForm, - priv iter: CharIterator<'a>, + priv iter: Chars<'a>, priv buffer: ~[(char, u8)], priv sorted: bool } -impl<'a> Iterator for NormalizationIterator<'a> { +impl<'a> Iterator for Normalizations<'a> { #[inline] fn next(&mut self) -> Option { use unicode::decompose::canonical_combining_class; @@ -1347,23 +1347,23 @@ pub trait StrSlice<'a> { /// let v: ~[char] = "abc åäö".chars().collect(); /// assert_eq!(v, ~['a', 'b', 'c', ' ', 'å', 'ä', 'ö']); /// ``` - fn chars(&self) -> CharIterator<'a>; + fn chars(&self) -> Chars<'a>; /// An iterator over the characters of `self`, in reverse order. - fn chars_rev(&self) -> CharRevIterator<'a>; + fn chars_rev(&self) -> RevChars<'a>; /// An iterator over the bytes of `self` - fn bytes(&self) -> ByteIterator<'a>; + fn bytes(&self) -> Bytes<'a>; /// An iterator over the bytes of `self`, in reverse order - fn bytes_rev(&self) -> ByteRevIterator<'a>; + fn bytes_rev(&self) -> RevBytes<'a>; /// An iterator over the characters of `self` and their byte offsets. - fn char_indices(&self) -> CharOffsetIterator<'a>; + fn char_indices(&self) -> CharOffsets<'a>; /// An iterator over the characters of `self` and their byte offsets, /// in reverse order. - fn char_indices_rev(&self) -> CharOffsetRevIterator<'a>; + fn char_indices_rev(&self) -> RevCharOffsets<'a>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`. @@ -1380,7 +1380,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = "lionXXtigerXleopard".split('X').collect(); /// assert_eq!(v, ~["lion", "", "tiger", "leopard"]); /// ``` - fn split(&self, sep: Sep) -> CharSplitIterator<'a, Sep>; + fn split(&self, sep: Sep) -> CharSplits<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`, restricted to splitting at most `count` @@ -1398,7 +1398,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = "lionXXtigerXleopard".splitn('X', 2).collect(); /// assert_eq!(v, ~["lion", "", "tigerXleopard"]); /// ``` - fn splitn(&self, sep: Sep, count: uint) -> CharSplitNIterator<'a, Sep>; + fn splitn(&self, sep: Sep, count: uint) -> CharSplitsN<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`. @@ -1415,7 +1415,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = "A..B..".split_terminator('.').collect(); /// assert_eq!(v, ~["A", "", "B", ""]); /// ``` - fn split_terminator(&self, sep: Sep) -> CharSplitIterator<'a, Sep>; + fn split_terminator(&self, sep: Sep) -> CharSplits<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`, in reverse order. @@ -1432,7 +1432,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = "lionXXtigerXleopard".rsplit('X').collect(); /// assert_eq!(v, ~["leopard", "tiger", "", "lion"]); /// ``` - fn rsplit(&self, sep: Sep) -> CharRSplitIterator<'a, Sep>; + fn rsplit(&self, sep: Sep) -> RevCharSplits<'a, Sep>; /// An iterator over substrings of `self`, separated by characters /// matched by `sep`, starting from the end of the string. @@ -1450,7 +1450,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = "lionXXtigerXleopard".rsplitn('X', 2).collect(); /// assert_eq!(v, ~["leopard", "tiger", "lionX"]); /// ``` - fn rsplitn(&self, sep: Sep, count: uint) -> CharSplitNIterator<'a, Sep>; + fn rsplitn(&self, sep: Sep, count: uint) -> CharSplitsN<'a, Sep>; /// An iterator over the start and end indices of the disjoint /// matches of `sep` within `self`. @@ -1472,7 +1472,7 @@ pub trait StrSlice<'a> { /// let v: ~[(uint, uint)] = "ababa".match_indices("aba").collect(); /// assert_eq!(v, ~[(0, 3)]); // only the first `aba` /// ``` - fn match_indices(&self, sep: &'a str) -> MatchesIndexIterator<'a>; + fn match_indices(&self, sep: &'a str) -> MatchIndices<'a>; /// An iterator over the substrings of `self` separated by `sep`. /// @@ -1485,7 +1485,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = "1abcabc2".split_str("abc").collect(); /// assert_eq!(v, ~["1", "", "2"]); /// ``` - fn split_str(&self, &'a str) -> StrSplitIterator<'a>; + fn split_str(&self, &'a str) -> StrSplits<'a>; /// An iterator over the lines of a string (subsequences separated /// by `\n`). This does not include the empty string after a @@ -1498,7 +1498,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = four_lines.lines().collect(); /// assert_eq!(v, ~["foo", "bar", "", "baz"]); /// ``` - fn lines(&self) -> CharSplitIterator<'a, char>; + fn lines(&self) -> CharSplits<'a, char>; /// An iterator over the lines of a string, separated by either /// `\n` or `\r\n`. As with `.lines()`, this does not include an @@ -1511,7 +1511,7 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = four_lines.lines_any().collect(); /// assert_eq!(v, ~["foo", "bar", "", "baz"]); /// ``` - fn lines_any(&self) -> AnyLineIterator<'a>; + fn lines_any(&self) -> AnyLines<'a>; /// An iterator over the words of a string (subsequences separated /// by any sequence of whitespace). Sequences of whitespace are @@ -1524,15 +1524,15 @@ pub trait StrSlice<'a> { /// let v: ~[&str] = some_words.words().collect(); /// assert_eq!(v, ~["Mary", "had", "a", "little", "lamb"]); /// ``` - fn words(&self) -> WordIterator<'a>; + fn words(&self) -> Words<'a>; /// An Iterator over the string in Unicode Normalization Form D /// (canonical decomposition). - fn nfd_chars(&self) -> NormalizationIterator<'a>; + fn nfd_chars(&self) -> Normalizations<'a>; /// An Iterator over the string in Unicode Normalization Form KD /// (compatibility decomposition). - fn nfkd_chars(&self) -> NormalizationIterator<'a>; + fn nfkd_chars(&self) -> Normalizations<'a>; /// Returns true if the string contains only whitespace. /// @@ -2008,38 +2008,38 @@ impl<'a> StrSlice<'a> for &'a str { } #[inline] - fn chars(&self) -> CharIterator<'a> { - CharIterator{string: *self} + fn chars(&self) -> Chars<'a> { + Chars{string: *self} } #[inline] - fn chars_rev(&self) -> CharRevIterator<'a> { + fn chars_rev(&self) -> RevChars<'a> { self.chars().invert() } #[inline] - fn bytes(&self) -> ByteIterator<'a> { + fn bytes(&self) -> Bytes<'a> { self.as_bytes().iter().map(|&b| b) } #[inline] - fn bytes_rev(&self) -> ByteRevIterator<'a> { + fn bytes_rev(&self) -> RevBytes<'a> { self.bytes().invert() } #[inline] - fn char_indices(&self) -> CharOffsetIterator<'a> { - CharOffsetIterator{string: *self, iter: self.chars()} + fn char_indices(&self) -> CharOffsets<'a> { + CharOffsets{string: *self, iter: self.chars()} } #[inline] - fn char_indices_rev(&self) -> CharOffsetRevIterator<'a> { + fn char_indices_rev(&self) -> RevCharOffsets<'a> { self.char_indices().invert() } #[inline] - fn split(&self, sep: Sep) -> CharSplitIterator<'a, Sep> { - CharSplitIterator { + fn split(&self, sep: Sep) -> CharSplits<'a, Sep> { + CharSplits { string: *self, only_ascii: sep.only_ascii(), sep: sep, @@ -2050,8 +2050,8 @@ impl<'a> StrSlice<'a> for &'a str { #[inline] fn splitn(&self, sep: Sep, count: uint) - -> CharSplitNIterator<'a, Sep> { - CharSplitNIterator { + -> CharSplitsN<'a, Sep> { + CharSplitsN { iter: self.split(sep), count: count, invert: false, @@ -2060,22 +2060,22 @@ impl<'a> StrSlice<'a> for &'a str { #[inline] fn split_terminator(&self, sep: Sep) - -> CharSplitIterator<'a, Sep> { - CharSplitIterator { + -> CharSplits<'a, Sep> { + CharSplits { allow_trailing_empty: false, ..self.split(sep) } } #[inline] - fn rsplit(&self, sep: Sep) -> CharRSplitIterator<'a, Sep> { + fn rsplit(&self, sep: Sep) -> RevCharSplits<'a, Sep> { self.split(sep).invert() } #[inline] fn rsplitn(&self, sep: Sep, count: uint) - -> CharSplitNIterator<'a, Sep> { - CharSplitNIterator { + -> CharSplitsN<'a, Sep> { + CharSplitsN { iter: self.split(sep), count: count, invert: true, @@ -2083,9 +2083,9 @@ impl<'a> StrSlice<'a> for &'a str { } #[inline] - fn match_indices(&self, sep: &'a str) -> MatchesIndexIterator<'a> { + fn match_indices(&self, sep: &'a str) -> MatchIndices<'a> { assert!(!sep.is_empty()) - MatchesIndexIterator { + MatchIndices { haystack: *self, needle: sep, position: 0 @@ -2093,8 +2093,8 @@ impl<'a> StrSlice<'a> for &'a str { } #[inline] - fn split_str(&self, sep: &'a str) -> StrSplitIterator<'a> { - StrSplitIterator { + fn split_str(&self, sep: &'a str) -> StrSplits<'a> { + StrSplits { it: self.match_indices(sep), last_end: 0, finished: false @@ -2102,11 +2102,11 @@ impl<'a> StrSlice<'a> for &'a str { } #[inline] - fn lines(&self) -> CharSplitIterator<'a, char> { + fn lines(&self) -> CharSplits<'a, char> { self.split_terminator('\n') } - fn lines_any(&self) -> AnyLineIterator<'a> { + fn lines_any(&self) -> AnyLines<'a> { self.lines().map(|line| { let l = line.len(); if l > 0 && line[l - 1] == '\r' as u8 { line.slice(0, l - 1) } @@ -2115,13 +2115,13 @@ impl<'a> StrSlice<'a> for &'a str { } #[inline] - fn words(&self) -> WordIterator<'a> { + fn words(&self) -> Words<'a> { self.split(char::is_whitespace).filter(|s| !s.is_empty()) } #[inline] - fn nfd_chars(&self) -> NormalizationIterator<'a> { - NormalizationIterator { + fn nfd_chars(&self) -> Normalizations<'a> { + Normalizations { iter: self.chars(), buffer: ~[], sorted: false, @@ -2130,8 +2130,8 @@ impl<'a> StrSlice<'a> for &'a str { } #[inline] - fn nfkd_chars(&self) -> NormalizationIterator<'a> { - NormalizationIterator { + fn nfkd_chars(&self) -> Normalizations<'a> { + Normalizations { iter: self.chars(), buffer: ~[], sorted: false, diff --git a/src/libstd/trie.rs b/src/libstd/trie.rs index b48edc72871..2c3fd18e587 100644 --- a/src/libstd/trie.rs +++ b/src/libstd/trie.rs @@ -115,8 +115,8 @@ impl TrieMap { } /// Get an iterator over the key-value pairs in the map - pub fn iter<'a>(&'a self) -> TrieMapIterator<'a, T> { - let mut iter = unsafe {TrieMapIterator::new()}; + pub fn iter<'a>(&'a self) -> Entries<'a, T> { + let mut iter = unsafe {Entries::new()}; iter.stack[0] = self.root.children.iter(); iter.length = 1; iter.remaining_min = self.length; @@ -127,8 +127,8 @@ impl TrieMap { /// Get an iterator over the key-value pairs in the map, with the /// ability to mutate the values. - pub fn mut_iter<'a>(&'a mut self) -> TrieMapMutIterator<'a, T> { - let mut iter = unsafe {TrieMapMutIterator::new()}; + pub fn mut_iter<'a>(&'a mut self) -> MutEntries<'a, T> { + let mut iter = unsafe {MutEntries::new()}; iter.stack[0] = self.root.children.mut_iter(); iter.length = 1; iter.remaining_min = self.length; @@ -221,8 +221,8 @@ macro_rules! bound { impl TrieMap { // If `upper` is true then returns upper_bound else returns lower_bound. #[inline] - fn bound<'a>(&'a self, key: uint, upper: bool) -> TrieMapIterator<'a, T> { - bound!(TrieMapIterator, self = self, + fn bound<'a>(&'a self, key: uint, upper: bool) -> Entries<'a, T> { + bound!(Entries, self = self, key = key, is_upper = upper, slice_from = slice_from, iter = iter, mutability = ) @@ -230,19 +230,19 @@ impl TrieMap { /// Get an iterator pointing to the first key-value pair whose key is not less than `key`. /// If all keys in the map are less than `key` an empty iterator is returned. - pub fn lower_bound<'a>(&'a self, key: uint) -> TrieMapIterator<'a, T> { + pub fn lower_bound<'a>(&'a self, key: uint) -> Entries<'a, T> { self.bound(key, false) } /// Get an iterator pointing to the first key-value pair whose key is greater than `key`. /// If all keys in the map are not greater than `key` an empty iterator is returned. - pub fn upper_bound<'a>(&'a self, key: uint) -> TrieMapIterator<'a, T> { + pub fn upper_bound<'a>(&'a self, key: uint) -> Entries<'a, T> { self.bound(key, true) } // If `upper` is true then returns upper_bound else returns lower_bound. #[inline] - fn mut_bound<'a>(&'a mut self, key: uint, upper: bool) -> TrieMapMutIterator<'a, T> { - bound!(TrieMapMutIterator, self = self, + fn mut_bound<'a>(&'a mut self, key: uint, upper: bool) -> MutEntries<'a, T> { + bound!(MutEntries, self = self, key = key, is_upper = upper, slice_from = mut_slice_from, iter = mut_iter, mutability = mut) @@ -250,13 +250,13 @@ impl TrieMap { /// Get an iterator pointing to the first key-value pair whose key is not less than `key`. /// If all keys in the map are less than `key` an empty iterator is returned. - pub fn mut_lower_bound<'a>(&'a mut self, key: uint) -> TrieMapMutIterator<'a, T> { + pub fn mut_lower_bound<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> { self.mut_bound(key, false) } /// Get an iterator pointing to the first key-value pair whose key is greater than `key`. /// If all keys in the map are not greater than `key` an empty iterator is returned. - pub fn mut_upper_bound<'a>(&'a mut self, key: uint) -> TrieMapMutIterator<'a, T> { + pub fn mut_upper_bound<'a>(&'a mut self, key: uint) -> MutEntries<'a, T> { self.mut_bound(key, true) } } @@ -329,20 +329,20 @@ impl TrieSet { /// Get an iterator over the values in the set #[inline] - pub fn iter<'a>(&'a self) -> TrieSetIterator<'a> { - TrieSetIterator{iter: self.map.iter()} + pub fn iter<'a>(&'a self) -> SetItems<'a> { + SetItems{iter: self.map.iter()} } /// Get an iterator pointing to the first value that is not less than `val`. /// If all values in the set are less than `val` an empty iterator is returned. - pub fn lower_bound<'a>(&'a self, val: uint) -> TrieSetIterator<'a> { - TrieSetIterator{iter: self.map.lower_bound(val)} + pub fn lower_bound<'a>(&'a self, val: uint) -> SetItems<'a> { + SetItems{iter: self.map.lower_bound(val)} } /// Get an iterator pointing to the first value that key is greater than `val`. /// If all values in the set are not greater than `val` an empty iterator is returned. - pub fn upper_bound<'a>(&'a self, val: uint) -> TrieSetIterator<'a> { - TrieSetIterator{iter: self.map.upper_bound(val)} + pub fn upper_bound<'a>(&'a self, val: uint) -> SetItems<'a> { + SetItems{iter: self.map.upper_bound(val)} } } @@ -474,8 +474,8 @@ fn remove(count: &mut uint, child: &mut Child, key: uint, } /// Forward iterator over a map -pub struct TrieMapIterator<'a, T> { - priv stack: [vec::VecIterator<'a, Child>, .. NUM_CHUNKS], +pub struct Entries<'a, T> { + priv stack: [vec::Items<'a, Child>, .. NUM_CHUNKS], priv length: uint, priv remaining_min: uint, priv remaining_max: uint @@ -483,8 +483,8 @@ pub struct TrieMapIterator<'a, T> { /// Forward iterator over the key-value pairs of a map, with the /// values being mutable. -pub struct TrieMapMutIterator<'a, T> { - priv stack: [vec::VecMutIterator<'a, Child>, .. NUM_CHUNKS], +pub struct MutEntries<'a, T> { + priv stack: [vec::MutItems<'a, Child>, .. NUM_CHUNKS], priv length: uint, priv remaining_min: uint, priv remaining_max: uint @@ -601,15 +601,15 @@ macro_rules! iterator_impl { } } -iterator_impl! { TrieMapIterator, iter = iter, mutability = } -iterator_impl! { TrieMapMutIterator, iter = mut_iter, mutability = mut } +iterator_impl! { Entries, iter = iter, mutability = } +iterator_impl! { MutEntries, iter = mut_iter, mutability = mut } /// Forward iterator over a set -pub struct TrieSetIterator<'a> { - priv iter: TrieMapIterator<'a, ()> +pub struct SetItems<'a> { + priv iter: Entries<'a, ()> } -impl<'a> Iterator for TrieSetIterator<'a> { +impl<'a> Iterator for SetItems<'a> { fn next(&mut self) -> Option { self.iter.next().map(|(key, _)| key) } diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index a7310bc75f1..d85e679c6a3 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -25,7 +25,7 @@ This is a big module, but for a high-level overview: ## Structs -Several structs that are useful for vectors, such as `VecIterator`, which +Several structs that are useful for vectors, such as `Items`, which represents iteration over a vector. ## Traits @@ -230,14 +230,14 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { /// An iterator over the slices of a vector separated by elements that /// match a predicate function. -pub struct SplitIterator<'a, T> { +pub struct Splits<'a, T> { priv v: &'a [T], priv n: uint, priv pred: 'a |t: &T| -> bool, priv finished: bool } -impl<'a, T> Iterator<&'a [T]> for SplitIterator<'a, T> { +impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> { #[inline] fn next(&mut self) -> Option<&'a [T]> { if self.finished { return None; } @@ -279,14 +279,14 @@ impl<'a, T> Iterator<&'a [T]> for SplitIterator<'a, T> { /// An iterator over the slices of a vector separated by elements that /// match a predicate function, from back to front. -pub struct RSplitIterator<'a, T> { +pub struct RevSplits<'a, T> { priv v: &'a [T], priv n: uint, priv pred: 'a |t: &T| -> bool, priv finished: bool } -impl<'a, T> Iterator<&'a [T]> for RSplitIterator<'a, T> { +impl<'a, T> Iterator<&'a [T]> for RevSplits<'a, T> { #[inline] fn next(&mut self) -> Option<&'a [T]> { if self.finished { return None; } @@ -514,12 +514,12 @@ impl Iterator<~[T]> for Permutations { /// An iterator over the (overlapping) slices of length `size` within /// a vector. #[deriving(Clone)] -pub struct WindowIter<'a, T> { +pub struct Windows<'a, T> { priv v: &'a [T], priv size: uint } -impl<'a, T> Iterator<&'a [T]> for WindowIter<'a, T> { +impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> { #[inline] fn next(&mut self) -> Option<&'a [T]> { if self.size > self.v.len() { @@ -548,12 +548,12 @@ impl<'a, T> Iterator<&'a [T]> for WindowIter<'a, T> { /// When the vector len is not evenly divided by the chunk size, /// the last slice of the iteration will be the remainder. #[deriving(Clone)] -pub struct ChunkIter<'a, T> { +pub struct Chunks<'a, T> { priv v: &'a [T], priv size: uint } -impl<'a, T> Iterator<&'a [T]> for ChunkIter<'a, T> { +impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> { #[inline] fn next(&mut self) -> Option<&'a [T]> { if self.v.len() == 0 { @@ -579,7 +579,7 @@ impl<'a, T> Iterator<&'a [T]> for ChunkIter<'a, T> { } } -impl<'a, T> DoubleEndedIterator<&'a [T]> for ChunkIter<'a, T> { +impl<'a, T> DoubleEndedIterator<&'a [T]> for Chunks<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a [T]> { if self.v.len() == 0 { @@ -595,7 +595,7 @@ impl<'a, T> DoubleEndedIterator<&'a [T]> for ChunkIter<'a, T> { } } -impl<'a, T> RandomAccessIterator<&'a [T]> for ChunkIter<'a, T> { +impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T> { #[inline] fn indexable(&self) -> uint { self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 } @@ -866,29 +866,29 @@ pub trait ImmutableVector<'a, T> { */ fn slice_to(&self, end: uint) -> &'a [T]; /// Returns an iterator over the vector - fn iter(self) -> VecIterator<'a, T>; + fn iter(self) -> Items<'a, T>; /// Returns a reversed iterator over a vector - fn rev_iter(self) -> RevIterator<'a, T>; + fn rev_iter(self) -> RevItems<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`. The matched element /// is not contained in the subslices. - fn split(self, pred: 'a |&T| -> bool) -> SplitIterator<'a, T>; + fn split(self, pred: 'a |&T| -> bool) -> Splits<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`, limited to splitting /// at most `n` times. The matched element is not contained in /// the subslices. - fn splitn(self, n: uint, pred: 'a |&T| -> bool) -> SplitIterator<'a, T>; + fn splitn(self, n: uint, pred: 'a |&T| -> bool) -> Splits<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred`. This starts at the /// end of the vector and works backwards. The matched element is /// not contained in the subslices. - fn rsplit(self, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T>; + fn rsplit(self, pred: 'a |&T| -> bool) -> RevSplits<'a, T>; /// Returns an iterator over the subslices of the vector which are /// separated by elements that match `pred` limited to splitting /// at most `n` times. This starts at the end of the vector and /// works backwards. The matched element is not contained in the /// subslices. - fn rsplitn(self, n: uint, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T>; + fn rsplitn(self, n: uint, pred: 'a |&T| -> bool) -> RevSplits<'a, T>; /** * Returns an iterator over all contiguous windows of length @@ -912,7 +912,7 @@ pub trait ImmutableVector<'a, T> { * ``` * */ - fn windows(self, size: uint) -> WindowIter<'a, T>; + fn windows(self, size: uint) -> Windows<'a, T>; /** * * Returns an iterator over `size` elements of the vector at a @@ -937,7 +937,7 @@ pub trait ImmutableVector<'a, T> { * ``` * */ - fn chunks(self, size: uint) -> ChunkIter<'a, T>; + fn chunks(self, size: uint) -> Chunks<'a, T>; /// Returns the element of a vector at the given index, or `None` if the /// index is out of bounds @@ -1055,15 +1055,15 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] { } #[inline] - fn iter(self) -> VecIterator<'a, T> { + fn iter(self) -> Items<'a, T> { unsafe { let p = self.as_ptr(); if mem::size_of::() == 0 { - VecIterator{ptr: p, + Items{ptr: p, end: (p as uint + self.len()) as *T, lifetime: None} } else { - VecIterator{ptr: p, + Items{ptr: p, end: p.offset(self.len() as int), lifetime: None} } @@ -1071,18 +1071,18 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] { } #[inline] - fn rev_iter(self) -> RevIterator<'a, T> { + fn rev_iter(self) -> RevItems<'a, T> { self.iter().invert() } #[inline] - fn split(self, pred: 'a |&T| -> bool) -> SplitIterator<'a, T> { + fn split(self, pred: 'a |&T| -> bool) -> Splits<'a, T> { self.splitn(uint::max_value, pred) } #[inline] - fn splitn(self, n: uint, pred: 'a |&T| -> bool) -> SplitIterator<'a, T> { - SplitIterator { + fn splitn(self, n: uint, pred: 'a |&T| -> bool) -> Splits<'a, T> { + Splits { v: self, n: n, pred: pred, @@ -1091,13 +1091,13 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] { } #[inline] - fn rsplit(self, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T> { + fn rsplit(self, pred: 'a |&T| -> bool) -> RevSplits<'a, T> { self.rsplitn(uint::max_value, pred) } #[inline] - fn rsplitn(self, n: uint, pred: 'a |&T| -> bool) -> RSplitIterator<'a, T> { - RSplitIterator { + fn rsplitn(self, n: uint, pred: 'a |&T| -> bool) -> RevSplits<'a, T> { + RevSplits { v: self, n: n, pred: pred, @@ -1106,15 +1106,15 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] { } #[inline] - fn windows(self, size: uint) -> WindowIter<'a, T> { + fn windows(self, size: uint) -> Windows<'a, T> { assert!(size != 0); - WindowIter { v: self, size: size } + Windows { v: self, size: size } } #[inline] - fn chunks(self, size: uint) -> ChunkIter<'a, T> { + fn chunks(self, size: uint) -> Chunks<'a, T> { assert!(size != 0); - ChunkIter { v: self, size: size } + Chunks { v: self, size: size } } #[inline] @@ -1331,10 +1331,10 @@ pub trait OwnedVector { /// println!("{}", s); /// } /// ``` - fn move_iter(self) -> MoveIterator; + fn move_iter(self) -> MoveItems; /// Creates a consuming iterator that moves out of the vector in /// reverse order. - fn move_rev_iter(self) -> MoveRevIterator; + fn move_rev_iter(self) -> RevMoveItems; /** * Reserves capacity for exactly `n` elements in the given vector. @@ -1479,16 +1479,16 @@ pub trait OwnedVector { impl OwnedVector for ~[T] { #[inline] - fn move_iter(self) -> MoveIterator { + fn move_iter(self) -> MoveItems { unsafe { let iter = cast::transmute(self.iter()); let ptr = cast::transmute(self); - MoveIterator { allocation: ptr, iter: iter } + MoveItems { allocation: ptr, iter: iter } } } #[inline] - fn move_rev_iter(self) -> MoveRevIterator { + fn move_rev_iter(self) -> RevMoveItems { self.move_iter().invert() } @@ -2065,18 +2065,18 @@ pub trait MutableVector<'a, T> { fn mut_slice_to(self, end: uint) -> &'a mut [T]; /// Returns an iterator that allows modifying each value - fn mut_iter(self) -> VecMutIterator<'a, T>; + fn mut_iter(self) -> MutItems<'a, T>; /// Returns a mutable pointer to the last item in the vector. fn mut_last(self) -> &'a mut T; /// Returns a reversed iterator that allows modifying each value - fn mut_rev_iter(self) -> MutRevIterator<'a, T>; + fn mut_rev_iter(self) -> RevMutItems<'a, T>; /// Returns an iterator over the mutable subslices of the vector /// which are separated by elements that match `pred`. The /// matched element is not contained in the subslices. - fn mut_split(self, pred: 'a |&T| -> bool) -> MutSplitIterator<'a, T>; + fn mut_split(self, pred: 'a |&T| -> bool) -> MutSplits<'a, T>; /** * Returns an iterator over `size` elements of the vector at a time. @@ -2088,7 +2088,7 @@ pub trait MutableVector<'a, T> { * * Fails if `size` is 0. */ - fn mut_chunks(self, chunk_size: uint) -> MutChunkIter<'a, T>; + fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T>; /** * Returns a mutable reference to the first element in this slice @@ -2317,15 +2317,15 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] { } #[inline] - fn mut_iter(self) -> VecMutIterator<'a, T> { + fn mut_iter(self) -> MutItems<'a, T> { unsafe { let p = self.as_mut_ptr(); if mem::size_of::() == 0 { - VecMutIterator{ptr: p, + MutItems{ptr: p, end: (p as uint + self.len()) as *mut T, lifetime: None} } else { - VecMutIterator{ptr: p, + MutItems{ptr: p, end: p.offset(self.len() as int), lifetime: None} } @@ -2340,19 +2340,19 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] { } #[inline] - fn mut_rev_iter(self) -> MutRevIterator<'a, T> { + fn mut_rev_iter(self) -> RevMutItems<'a, T> { self.mut_iter().invert() } #[inline] - fn mut_split(self, pred: 'a |&T| -> bool) -> MutSplitIterator<'a, T> { - MutSplitIterator { v: self, pred: pred, finished: false } + fn mut_split(self, pred: 'a |&T| -> bool) -> MutSplits<'a, T> { + MutSplits { v: self, pred: pred, finished: false } } #[inline] - fn mut_chunks(self, chunk_size: uint) -> MutChunkIter<'a, T> { + fn mut_chunks(self, chunk_size: uint) -> MutChunks<'a, T> { assert!(chunk_size > 0); - MutChunkIter { v: self, chunk_size: chunk_size } + MutChunks { v: self, chunk_size: chunk_size } } fn mut_shift_ref(&mut self) -> &'a mut T { @@ -2735,7 +2735,7 @@ macro_rules! iterator { } } -impl<'a, T> RandomAccessIterator<&'a T> for VecIterator<'a, T> { +impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> { #[inline] fn indexable(&self) -> uint { let (exact, _) = self.size_hint(); @@ -2754,28 +2754,28 @@ impl<'a, T> RandomAccessIterator<&'a T> for VecIterator<'a, T> { } } -iterator!{struct VecIterator -> *T, &'a T} -pub type RevIterator<'a, T> = Invert>; +iterator!{struct Items -> *T, &'a T} +pub type RevItems<'a, T> = Invert>; -impl<'a, T> ExactSize<&'a T> for VecIterator<'a, T> {} -impl<'a, T> ExactSize<&'a mut T> for VecMutIterator<'a, T> {} +impl<'a, T> ExactSize<&'a T> for Items<'a, T> {} +impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {} -impl<'a, T> Clone for VecIterator<'a, T> { - fn clone(&self) -> VecIterator<'a, T> { *self } +impl<'a, T> Clone for Items<'a, T> { + fn clone(&self) -> Items<'a, T> { *self } } -iterator!{struct VecMutIterator -> *mut T, &'a mut T} -pub type MutRevIterator<'a, T> = Invert>; +iterator!{struct MutItems -> *mut T, &'a mut T} +pub type RevMutItems<'a, T> = Invert>; /// An iterator over the subslices of the vector which are separated /// by elements that match `pred`. -pub struct MutSplitIterator<'a, T> { +pub struct MutSplits<'a, T> { priv v: &'a mut [T], priv pred: 'a |t: &T| -> bool, priv finished: bool } -impl<'a, T> Iterator<&'a mut [T]> for MutSplitIterator<'a, T> { +impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> { #[inline] fn next(&mut self) -> Option<&'a mut [T]> { if self.finished { return None; } @@ -2810,7 +2810,7 @@ impl<'a, T> Iterator<&'a mut [T]> for MutSplitIterator<'a, T> { } } -impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplitIterator<'a, T> { +impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplits<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a mut [T]> { if self.finished { return None; } @@ -2834,12 +2834,12 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplitIterator<'a, T> { /// An iterator over a vector in (non-overlapping) mutable chunks (`size` elements at a time). When /// the vector len is not evenly divided by the chunk size, the last slice of the iteration will be /// the remainder. -pub struct MutChunkIter<'a, T> { +pub struct MutChunks<'a, T> { priv v: &'a mut [T], priv chunk_size: uint } -impl<'a, T> Iterator<&'a mut [T]> for MutChunkIter<'a, T> { +impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> { #[inline] fn next(&mut self) -> Option<&'a mut [T]> { if self.v.len() == 0 { @@ -2865,7 +2865,7 @@ impl<'a, T> Iterator<&'a mut [T]> for MutChunkIter<'a, T> { } } -impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunkIter<'a, T> { +impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> { #[inline] fn next_back(&mut self) -> Option<&'a mut [T]> { if self.v.len() == 0 { @@ -2883,12 +2883,12 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunkIter<'a, T> { } /// An iterator that moves out of a vector. -pub struct MoveIterator { +pub struct MoveItems { priv allocation: *mut u8, // the block of memory allocated for the vector - priv iter: VecIterator<'static, T> + priv iter: Items<'static, T> } -impl Iterator for MoveIterator { +impl Iterator for MoveItems { #[inline] fn next(&mut self) -> Option { unsafe { @@ -2902,7 +2902,7 @@ impl Iterator for MoveIterator { } } -impl DoubleEndedIterator for MoveIterator { +impl DoubleEndedIterator for MoveItems { #[inline] fn next_back(&mut self) -> Option { unsafe { @@ -2912,7 +2912,7 @@ impl DoubleEndedIterator for MoveIterator { } #[unsafe_destructor] -impl Drop for MoveIterator { +impl Drop for MoveItems { fn drop(&mut self) { // destroy the remaining elements for _x in *self {} @@ -2923,7 +2923,7 @@ impl Drop for MoveIterator { } /// An iterator that moves out of a vector in reverse order. -pub type MoveRevIterator = Invert>; +pub type RevMoveItems = Invert>; impl FromIterator for ~[A] { fn from_iterator>(iterator: &mut T) -> ~[A] { -- cgit 1.4.1-3-g733a5