diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-22 12:49:57 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-22 12:49:57 -0800 |
| commit | 459f3b2cfa0e618d6e28ce564a363a9477567f71 (patch) | |
| tree | 4d308abea1b026ac9db0e538f6d01170b173c89f /src/libstd | |
| parent | 6938d51122f37dd7ab213b88bc2d457c5a9da781 (diff) | |
| parent | 22050e3ed44d9b4d79edced506b470a425e0d302 (diff) | |
| download | rust-459f3b2cfa0e618d6e28ce564a363a9477567f71.tar.gz rust-459f3b2cfa0e618d6e28ce564a363a9477567f71.zip | |
rollup merge of #20056: MrFloya/iter_rename
Conflicts: src/libcollections/bit.rs src/libcore/str.rs
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 20 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 4 | ||||
| -rw-r--r-- | src/libstd/collections/hash/table.rs | 16 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 8149864afd4..692f120737a 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -914,8 +914,8 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { /// } /// ``` #[unstable = "matches collection reform specification, waiting for dust to settle"] - pub fn iter_mut(&mut self) -> MutEntries<K, V> { - MutEntries { inner: self.table.iter_mut() } + pub fn iter_mut(&mut self) -> IterMut<K, V> { + IterMut { inner: self.table.iter_mut() } } /// Creates a consuming iterator, that is, one that moves each key-value @@ -936,10 +936,10 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { /// let vec: Vec<(&str, int)> = map.into_iter().collect(); /// ``` #[unstable = "matches collection reform specification, waiting for dust to settle"] - pub fn into_iter(self) -> MoveEntries<K, V> { + pub fn into_iter(self) -> IntoIter<K, V> { fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) } - MoveEntries { + IntoIter { inner: self.table.into_iter().map(last_two) } } @@ -1306,16 +1306,16 @@ pub struct Entries<'a, K: 'a, V: 'a> { } /// HashMap mutable values iterator -pub struct MutEntries<'a, K: 'a, V: 'a> { - inner: table::MutEntries<'a, K, V> +pub struct IterMut<'a, K: 'a, V: 'a> { + inner: table::IterMut<'a, K, V> } /// HashMap move iterator -pub struct MoveEntries<K, V> { +pub struct IntoIter<K, V> { inner: iter::Map< (SafeHash, K, V), (K, V), - table::MoveEntries<K, V>, + table::IntoIter<K, V>, fn((SafeHash, K, V)) -> (K, V), > } @@ -1374,12 +1374,12 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> { #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } -impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> { #[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } -impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> { +impl<K, V> Iterator<(K, V)> for IntoIter<K, V> { #[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 0024c98b074..3d5be042963 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -23,7 +23,7 @@ use ops::{BitOr, BitAnd, BitXor, Sub}; use option::Option::{Some, None, mod}; use result::Result::{Ok, Err}; -use super::map::{mod, HashMap, MoveEntries, Keys, INITIAL_CAPACITY}; +use super::map::{mod, HashMap, Keys, INITIAL_CAPACITY}; // Future Optimization (FIXME!) // ============================= @@ -736,7 +736,7 @@ pub struct Iter<'a, K: 'a> { /// HashSet move iterator pub struct IntoIter<K> { - iter: Map<(K, ()), K, MoveEntries<K, ()>, fn((K, ())) -> K> + iter: Map<(K, ()), K, map::IntoIter<K, ()>, fn((K, ())) -> K> } /// HashSet drain iterator diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index ce7dbd8ea5e..8f2152c5a9d 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -664,17 +664,17 @@ impl<K, V> RawTable<K, V> { } } - pub fn iter_mut(&mut self) -> MutEntries<K, V> { - MutEntries { + pub fn iter_mut(&mut self) -> IterMut<K, V> { + IterMut { iter: self.raw_buckets(), elems_left: self.size(), } } - pub fn into_iter(self) -> MoveEntries<K, V> { + pub fn into_iter(self) -> IntoIter<K, V> { let RawBuckets { raw, hashes_end, .. } = self.raw_buckets(); // Replace the marker regardless of lifetime bounds on parameters. - MoveEntries { + IntoIter { iter: RawBuckets { raw: raw, hashes_end: hashes_end, @@ -776,13 +776,13 @@ pub struct Entries<'a, K: 'a, V: 'a> { } /// Iterator over mutable references to entries in a table. -pub struct MutEntries<'a, K: 'a, V: 'a> { +pub struct IterMut<'a, K: 'a, V: 'a> { iter: RawBuckets<'a, K, V>, elems_left: uint, } /// Iterator over the entries in a table, consuming the table. -pub struct MoveEntries<K, V> { +pub struct IntoIter<K, V> { table: RawTable<K, V>, iter: RawBuckets<'static, K, V> } @@ -809,7 +809,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> { } } -impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> { +impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> { fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.iter.next().map(|bucket| { self.elems_left -= 1; @@ -825,7 +825,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> { } } -impl<K, V> Iterator<(SafeHash, K, V)> for MoveEntries<K, V> { +impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> { fn next(&mut self) -> Option<(SafeHash, K, V)> { self.iter.next().map(|bucket| { self.table.size -= 1; |
