Forward more Iterator methods for str::Bytes
These are overridden by slice::Iter
This commit is contained in:
parent
b2c0707872
commit
b90e5107c0
1 changed files with 38 additions and 0 deletions
|
@ -710,6 +710,37 @@ impl<'a> Iterator for Bytes<'a> {
|
||||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||||
self.0.nth(n)
|
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")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
@ -718,6 +749,13 @@ impl<'a> DoubleEndedIterator for Bytes<'a> {
|
||||||
fn next_back(&mut self) -> Option<u8> {
|
fn next_back(&mut self) -> Option<u8> {
|
||||||
self.0.next_back()
|
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")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
Loading…
Add table
Reference in a new issue