Skip to content

Commit de20f53

Browse files
committed
Implement Iterator for &mut I where I: Iterator + Sized.
1 parent 61600f6 commit de20f53

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/iter/traits/iterator.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,16 @@ impl<I: Iterator + ?Sized> Iterator for &mut I {
27082708
fn nth(&mut self, n: usize) -> Option<Self::Item> {
27092709
(**self).nth(n)
27102710
}
2711+
}
2712+
2713+
#[stable(feature = "rust1", since = "1.0.0")]
2714+
impl<I: Iterator> Iterator for &mut I {
2715+
type Item = I::Item;
2716+
fn next(&mut self) -> Option<I::Item> { (**self).next() }
2717+
fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() }
2718+
fn nth(&mut self, n: usize) -> Option<Self::Item> {
2719+
(**self).nth(n)
2720+
}
27112721
fn try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R where
27122722
I: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Ok=B>
27132723
{

0 commit comments

Comments
 (0)