about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-23 12:02:27 +0000
committerbors <bors@rust-lang.org>2015-01-23 12:02:27 +0000
commit86fbdbfbcd4c019fda26ff73b9e1e30ed7a8b174 (patch)
tree28041b766151dbaee456ced9bbf4466397a64c00 /src/libcore
parentaedcbb9d82ccd7ead4b075ff55a99e363be94174 (diff)
parent1479de86885c5c2b35556cc89196a6d2385341c8 (diff)
downloadrust-86fbdbfbcd4c019fda26ff73b9e1e30ed7a8b174.tar.gz
rust-86fbdbfbcd4c019fda26ff73b9e1e30ed7a8b174.zip
Auto merge of #21453 - Stebalien:exactsize, r=alexcrichton
Specifically:
 * Peekable
 * ByRef
 * Skip
 * Take
 * Fuse

Fixes  #20547
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index fc3a8ae6590..2673cf1af78 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -1128,6 +1128,9 @@ impl<'a, I> DoubleEndedIterator for ByRef<'a, I> where I: 'a + DoubleEndedIterat
     fn next_back(&mut self) -> Option<<I as Iterator>::Item> { self.iter.next_back() }
 }
 
+#[stable]
+impl<'a, I> ExactSizeIterator for ByRef<'a, I> where I: 'a + ExactSizeIterator {}
+
 /// A trait for iterators over elements which can be added together
 #[unstable = "needs to be re-evaluated as part of numerics reform"]
 pub trait AdditiveIterator<A> {
@@ -1832,6 +1835,9 @@ impl<T, I> Iterator for Peekable<T, I> where I: Iterator<Item=T> {
 }
 
 #[stable]
+impl<T, I> ExactSizeIterator for Peekable<T, I> where I: ExactSizeIterator<Item = T> {}
+
+#[stable]
 impl<T, I> Peekable<T, I> where I: Iterator<Item=T> {
     /// Return a reference to the next element of the iterator with out advancing it,
     /// or None if the iterator is exhausted.
@@ -2023,6 +2029,9 @@ impl<I> RandomAccessIterator for Skip<I> where I: RandomAccessIterator{
     }
 }
 
+#[stable]
+impl<I> ExactSizeIterator for Skip<I> where I: ExactSizeIterator {}
+
 /// An iterator that only iterates over the first `n` iterations of `iter`.
 #[derive(Clone)]
 #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@@ -2078,6 +2087,9 @@ impl<I> RandomAccessIterator for Take<I> where I: RandomAccessIterator{
     }
 }
 
+#[stable]
+impl<I> ExactSizeIterator for Take<I> where I: ExactSizeIterator {}
+
 
 /// An iterator to maintain state while iterating another iterator
 #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@@ -2287,6 +2299,9 @@ impl<I> RandomAccessIterator for Fuse<I> where I: RandomAccessIterator {
     }
 }
 
+#[stable]
+impl<I> ExactSizeIterator for Fuse<I> where I: ExactSizeIterator {}
+
 impl<I> Fuse<I> {
     /// Resets the fuse such that the next call to .next() or .next_back() will
     /// call the underlying iterator again even if it previously returned None.