Skip to content

Commit

Permalink
Forward more Iterator methods for str::Bytes
Browse files Browse the repository at this point in the history
These are overridden by slice::Iter
  • Loading branch information
SimonSapin authored and alexcrichton committed Jul 13, 2017
1 parent b2c0707 commit b90e510
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/libcore/str/mod.rs
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

0 comments on commit b90e510

Please sign in to comment.