Skip to content

Commit 91a031d

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 178685 b: refs/heads/snap-stage3 c: 9f90d66 h: refs/heads/master i: 178683: e034699 v: v3
1 parent 9d508e5 commit 91a031d

File tree

2 files changed

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

2 files changed

+28
-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: afabb022b026ba021a3bbb0c0c465b6f66a41395
4+
refs/heads/snap-stage3: 9f90d666e0cd9a73ef35b76b6605f9d1f69df849
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/set.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use default::Default;
1818
use fmt::Debug;
1919
use fmt;
2020
use hash::{self, Hash};
21-
use iter::{Iterator, ExactSizeIterator, IteratorExt, FromIterator, Map, Chain, Extend};
21+
use iter::{
22+
Iterator, IntoIterator, ExactSizeIterator, IteratorExt, FromIterator, Map, Chain, Extend,
23+
};
2224
use ops::{BitOr, BitAnd, BitXor, Sub};
2325
use option::Option::{Some, None, self};
2426

@@ -833,6 +835,30 @@ pub struct Union<'a, T: 'a, S: 'a> {
833835
iter: Chain<Iter<'a, T>, Difference<'a, T, S>>
834836
}
835837

838+
impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S>
839+
where T: Eq + Hash<H>,
840+
S: HashState<Hasher=H>,
841+
H: hash::Hasher<Output=u64>
842+
{
843+
type Iter = Iter<'a, T>;
844+
845+
fn into_iter(self) -> Iter<'a, T> {
846+
self.iter()
847+
}
848+
}
849+
850+
impl<T, S, H> IntoIterator for HashSet<T, S>
851+
where T: Eq + Hash<H>,
852+
S: HashState<Hasher=H>,
853+
H: hash::Hasher<Output=u64>
854+
{
855+
type Iter = IntoIter<T>;
856+
857+
fn into_iter(self) -> IntoIter<T> {
858+
self.into_iter()
859+
}
860+
}
861+
836862
#[stable(feature = "rust1", since = "1.0.0")]
837863
impl<'a, K> Iterator for Iter<'a, K> {
838864
type Item = &'a K;

0 commit comments

Comments
 (0)