mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Forward more Iterator methods for iter::Rev
`position` could not be implemented because calling `rposition` on the inner iterator would require more trait bounds.
This commit is contained in:
parent
b90e5107c0
commit
2007987099
@ -359,11 +359,19 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
|
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
|
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
|
||||||
where P: FnMut(&Self::Item) -> bool
|
where P: FnMut(&Self::Item) -> bool
|
||||||
{
|
{
|
||||||
self.iter.rfind(predicate)
|
self.iter.rfind(predicate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
|
||||||
|
P: FnMut(Self::Item) -> bool
|
||||||
|
{
|
||||||
|
self.iter.position(predicate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
Loading…
Reference in New Issue
Block a user