Skip to content

Commit 2007987

Browse files
SimonSapinalexcrichton
authored andcommitted
Forward more Iterator methods for iter::Rev
`position` could not be implemented because calling `rposition` on the inner iterator would require more trait bounds.
1 parent b90e510 commit 2007987

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libcore/iter/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,19 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
359359
#[inline]
360360
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
361361

362+
#[inline]
362363
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
363364
where P: FnMut(&Self::Item) -> bool
364365
{
365366
self.iter.rfind(predicate)
366367
}
368+
369+
#[inline]
370+
fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
371+
P: FnMut(Self::Item) -> bool
372+
{
373+
self.iter.position(predicate)
374+
}
367375
}
368376

369377
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)