From 3aead52586d26f375e6318fb6980280db18b70b7 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 14 Sep 2013 16:37:52 -0400 Subject: [PATCH] iter: move Counter impl to the proper place --- src/libstd/iter.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 8407b068344..faa2d715df4 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -1719,6 +1719,20 @@ pub fn count(start: A, step: A) -> Counter { Counter{state: start, step: step} } +impl + Clone> Iterator for Counter { + #[inline] + fn next(&mut self) -> Option { + let result = self.state.clone(); + self.state = self.state + self.step; + Some(result) + } + + #[inline] + fn size_hint(&self) -> (uint, Option) { + (uint::max_value, None) // Too bad we can't specify an infinite lower bound + } +} + /// An iterator over the range [start, stop) #[deriving(Clone, DeepClone)] pub struct Range { @@ -1824,20 +1838,6 @@ impl + Integer + Ord + Clone> DoubleEndedIterator for RangeInclu } } -impl + Clone> Iterator for Counter { - #[inline] - fn next(&mut self) -> Option { - let result = self.state.clone(); - self.state = self.state + self.step; - Some(result) - } - - #[inline] - fn size_hint(&self) -> (uint, Option) { - (uint::max_value, None) // Too bad we can't specify an infinite lower bound - } -} - /// An iterator that repeats an element endlessly #[deriving(Clone, DeepClone)] pub struct Repeat {