Rename remaining hashmap and hashtable iterators to match naming

conventions.

This is a [breaking-change].
This commit is contained in:
Chase Southwood 2014-12-24 20:19:48 -06:00
parent 7e11b22713
commit 625697354d
2 changed files with 11 additions and 11 deletions

View File

@ -888,8 +888,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"] #[unstable = "matches collection reform specification, waiting for dust to settle"]
pub fn iter(&self) -> Entries<K, V> { pub fn iter(&self) -> Iter<K, V> {
Entries { inner: self.table.iter() } Iter { inner: self.table.iter() }
} }
/// An iterator visiting all key-value pairs in arbitrary order, /// An iterator visiting all key-value pairs in arbitrary order,
@ -1305,8 +1305,8 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K
} }
/// HashMap iterator /// HashMap iterator
pub struct Entries<'a, K: 'a, V: 'a> { pub struct Iter<'a, K: 'a, V: 'a> {
inner: table::Entries<'a, K, V> inner: table::Iter<'a, K, V>
} }
/// HashMap mutable values iterator /// HashMap mutable values iterator
@ -1326,12 +1326,12 @@ pub struct IntoIter<K, V> {
/// HashMap keys iterator /// HashMap keys iterator
pub struct Keys<'a, K: 'a, V: 'a> { pub struct Keys<'a, K: 'a, V: 'a> {
inner: Map<(&'a K, &'a V), &'a K, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a K> inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
} }
/// HashMap values iterator /// HashMap values iterator
pub struct Values<'a, K: 'a, V: 'a> { pub struct Values<'a, K: 'a, V: 'a> {
inner: Map<(&'a K, &'a V), &'a V, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a V> inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
} }
/// HashMap drain iterator /// HashMap drain iterator
@ -1373,7 +1373,7 @@ enum VacantEntryState<K, V, M> {
NoElem(EmptyBucket<K, V, M>), NoElem(EmptyBucket<K, V, M>),
} }
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> { impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
#[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() } #[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
} }

View File

@ -657,8 +657,8 @@ impl<K, V> RawTable<K, V> {
} }
} }
pub fn iter(&self) -> Entries<K, V> { pub fn iter(&self) -> Iter<K, V> {
Entries { Iter {
iter: self.raw_buckets(), iter: self.raw_buckets(),
elems_left: self.size(), elems_left: self.size(),
} }
@ -770,7 +770,7 @@ impl<'a, K, V> Iterator<(K, V)> for RevMoveBuckets<'a, K, V> {
} }
/// Iterator over shared references to entries in a table. /// Iterator over shared references to entries in a table.
pub struct Entries<'a, K: 'a, V: 'a> { pub struct Iter<'a, K: 'a, V: 'a> {
iter: RawBuckets<'a, K, V>, iter: RawBuckets<'a, K, V>,
elems_left: uint, elems_left: uint,
} }
@ -793,7 +793,7 @@ pub struct Drain<'a, K: 'a, V: 'a> {
iter: RawBuckets<'static, K, V>, iter: RawBuckets<'static, K, V>,
} }
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> { impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
fn next(&mut self) -> Option<(&'a K, &'a V)> { fn next(&mut self) -> Option<(&'a K, &'a V)> {
self.iter.next().map(|bucket| { self.iter.next().map(|bucket| {
self.elems_left -= 1; self.elems_left -= 1;