Forward more Iterator methods for str::Bytes

These are overridden by slice::Iter
This commit is contained in:
Simon Sapin 2017-07-05 20:21:29 +02:00 committed by Alex Crichton
parent b2c0707872
commit b90e5107c0

View File

@ -710,6 +710,37 @@ fn last(self) -> Option<Self::Item> {
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")]
@ -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")]