Skip to content

Commit 20aba8d

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 178166 b: refs/heads/tmp c: 9f90d66 h: refs/heads/master v: v3
1 parent c2b6bc5 commit 20aba8d

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-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: afabb022b026ba021a3bbb0c0c465b6f66a41395
37+
refs/heads/tmp: 9f90d666e0cd9a73ef35b76b6605f9d1f69df849

branches/tmp/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)