diff options
| author | blake2-ppc <blake2-ppc> | 2013-07-18 17:38:17 +0200 |
|---|---|---|
| committer | blake2-ppc <blake2-ppc> | 2013-07-20 20:30:57 +0200 |
| commit | 24b6901b26f0bde00706a5cbc16ffc29296ea40d (patch) | |
| tree | f3eece8ac0576df1f1e57119a94a78944c2eedc6 /src/libstd/hashmap.rs | |
| parent | ffe2623e47d9c5a5914865a9556cb1298ca00058 (diff) | |
std: Implement Clone for VecIterator and iterators using it
The theory is simple, the immutable iterators simply hold state variables (indicies or pointers) into frozen containers. We can freely clone these iterators, just like we can clone borrowed pointers. VecIterator needs a manual impl to handle the lifetime struct member.
Diffstat (limited to 'src/libstd/hashmap.rs')
| -rw-r--r-- | src/libstd/hashmap.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs index 182ee37202a..56774560d1d 100644 --- a/src/libstd/hashmap.rs +++ b/src/libstd/hashmap.rs @@ -548,6 +548,7 @@ impl<K:Hash + Eq + Clone,V:Clone> Clone for HashMap<K,V> { } /// HashMap iterator +#[deriving(Clone)] pub struct HashMapIterator<'self, K, V> { priv iter: vec::VecIterator<'self, Option<Bucket<K, V>>>, } @@ -563,6 +564,7 @@ pub struct HashMapConsumeIterator<K, V> { } /// HashSet iterator +#[deriving(Clone)] pub struct HashSetIterator<'self, K> { priv iter: vec::VecIterator<'self, Option<Bucket<K, ()>>>, } |
