Skip to content

Commit 9d508e5

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 178684 b: refs/heads/snap-stage3 c: afabb02 h: refs/heads/master v: v3
1 parent e034699 commit 9d508e5

File tree

2 files changed

+38
-2
lines changed
  • branches/snap-stage3/src/libstd/collections/hash

2 files changed

+38
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 3d072a193bfcb76206aab576049e696d6d8db25d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 134cf707dfb8f37d735d20ff261366b7c2d916a6
4+
refs/heads/snap-stage3: afabb022b026ba021a3bbb0c0c465b6f66a41395
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/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)