Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,19 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }

#[inline]
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where P: FnMut(&Self::Item) -> bool
{
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")]
Expand Down
38 changes: 38 additions & 0 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,37 @@ impl<'a> Iterator for Bytes<'a> {
fn nth(&mut self, n: usize) -> Option<Self::Item> {
self.0.nth(n)
}

#[inline]
fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool {
self.0.all(f)
}

#[inline]
fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool {
self.0.any(f)
}

#[inline]
fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where
P: FnMut(&Self::Item) -> bool
{
self.0.find(predicate)
}

#[inline]
fn position<P>(&mut self, predicate: P) -> Option<usize> where
P: FnMut(Self::Item) -> bool
{
self.0.position(predicate)
}

#[inline]
fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
P: FnMut(Self::Item) -> bool
{
self.0.rposition(predicate)
}
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -718,6 +749,13 @@ impl<'a> DoubleEndedIterator for Bytes<'a> {
fn next_back(&mut self) -> Option<u8> {
self.0.next_back()
}

#[inline]
fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where
P: FnMut(&Self::Item) -> bool
{
self.0.rfind(predicate)
}
}

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