]> git.lizzy.rs Git - rust.git/commitdiff
iterator: Let closure-less iterators derive Clone
authorblake2-ppc <blake2-ppc>
Thu, 18 Jul 2013 15:31:33 +0000 (17:31 +0200)
committerblake2-ppc <blake2-ppc>
Sat, 20 Jul 2013 18:22:48 +0000 (20:22 +0200)
src/libstd/iterator.rs

index 13c234d63974cb8f60d7a1e4d85b940a0d5e15f2..ce1c1d585d1be7765385b7fb34379827c51afbc0 100644 (file)
@@ -74,6 +74,7 @@ fn invert(self) -> InvertIterator<A, T> {
 
 /// An double-ended iterator with the direction inverted
 // FIXME #6967: Dummy A parameter to get around type inference bug
+#[deriving(Clone)]
 pub struct InvertIterator<A, T> {
     priv iter: T
 }
@@ -753,6 +754,7 @@ fn cycle(self) -> CycleIterator<A, T> {
 }
 
 /// An iterator that repeats endlessly
+#[deriving(Clone)]
 pub struct CycleIterator<A, T> {
     priv orig: T,
     priv iter: T,
@@ -780,6 +782,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 
 /// An iterator which strings two iterators together
 // FIXME #6967: Dummy A parameter to get around type inference bug
+#[deriving(Clone)]
 pub struct ChainIterator<A, T, U> {
     priv a: T,
     priv b: U,
@@ -835,6 +838,7 @@ fn next_back(&mut self) -> Option<A> {
 
 /// An iterator which iterates two other iterators simultaneously
 // FIXME #6967: Dummy A & B parameters to get around type inference bug
+#[deriving(Clone)]
 pub struct ZipIterator<A, T, B, U> {
     priv a: T,
     priv b: U
@@ -988,6 +992,7 @@ fn next_back(&mut self) -> Option<B> {
 
 /// An iterator which yields the current count and the element during iteration
 // FIXME #6967: Dummy A parameter to get around type inference bug
+#[deriving(Clone)]
 pub struct EnumerateIterator<A, T> {
     priv iter: T,
     priv count: uint
@@ -1086,6 +1091,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 
 /// An iterator which skips over `n` elements of `iter`.
 // FIXME #6967: Dummy A parameter to get around type inference bug
+#[deriving(Clone)]
 pub struct SkipIterator<A, T> {
     priv iter: T,
     priv n: uint
@@ -1134,6 +1140,7 @@ fn size_hint(&self) -> (uint, Option<uint>) {
 
 /// An iterator which only iterates over the first `n` iterations of `iter`.
 // FIXME #6967: Dummy A parameter to get around type inference bug
+#[deriving(Clone)]
 pub struct TakeIterator<A, T> {
     priv iter: T,
     priv n: uint
@@ -1285,6 +1292,7 @@ fn next(&mut self) -> Option<A> {
 
 /// An infinite iterator starting at `start` and advancing by `step` with each
 /// iteration
+#[deriving(Clone)]
 pub struct Counter<A> {
     /// The current state the counter is at (next value to be yielded)
     state: A,