Skip to content

Commit c2b6bc5

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 178165 b: refs/heads/tmp c: afabb02 h: refs/heads/master i: 178163: d45da9a v: v3
1 parent 1f1eaef commit c2b6bc5

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 134cf707dfb8f37d735d20ff261366b7c2d916a6
37+
refs/heads/tmp: afabb022b026ba021a3bbb0c0c465b6f66a41395

branches/tmp/src/libstd/collections/hash/map.rs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use cmp::{max, Eq, PartialEq};
2020
use default::Default;
2121
use fmt::{self, Debug};
2222
use hash::{self, Hash, SipHasher};
23-
use iter::{self, Iterator, ExactSizeIterator, IteratorExt, FromIterator, Extend, Map};
23+
use iter::{self, Iterator, ExactSizeIterator, IntoIterator, IteratorExt, FromIterator, Extend, Map};
2424
use marker::Sized;
2525
use mem::{self, replace};
2626
use num::{Int, UnsignedInt};
@@ -1385,6 +1385,42 @@ enum VacantEntryState<K, V, M> {
13851385
NoElem(EmptyBucket<K, V, M>),
13861386
}
13871387

1388+
impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S>
1389+
where K: Eq + Hash<H>,
1390+
S: HashState<Hasher=H>,
1391+
H: hash::Hasher<Output=u64>
1392+
{
1393+
type Iter = Iter<'a, K, V>;
1394+
1395+
fn into_iter(self) -> Iter<'a, K, V> {
1396+
self.iter()
1397+
}
1398+
}
1399+
1400+
impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S>
1401+
where K: Eq + Hash<H>,
1402+
S: HashState<Hasher=H>,
1403+
H: hash::Hasher<Output=u64>
1404+
{
1405+
type Iter = IterMut<'a, K, V>;
1406+
1407+
fn into_iter(mut self) -> IterMut<'a, K, V> {
1408+
self.iter_mut()
1409+
}
1410+
}
1411+
1412+
impl<K, V, S, H> IntoIterator for HashMap<K, V, S>
1413+
where K: Eq + Hash<H>,
1414+
S: HashState<Hasher=H>,
1415+
H: hash::Hasher<Output=u64>
1416+
{
1417+
type Iter = IntoIter<K, V>;
1418+
1419+
fn into_iter(mut self) -> IntoIter<K, V> {
1420+
self.into_iter()
1421+
}
1422+
}
1423+
13881424
#[stable(feature = "rust1", since = "1.0.0")]
13891425
impl<'a, K, V> Iterator for Iter<'a, K, V> {
13901426
type Item = (&'a K, &'a V);

0 commit comments

Comments
 (0)