Skip to content

Commit b90e510

Browse files
SimonSapinalexcrichton
authored andcommitted
Forward more Iterator methods for str::Bytes
These are overridden by slice::Iter
1 parent b2c0707 commit b90e510

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/libcore/str/mod.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,37 @@ impl<'a> Iterator for Bytes<'a> {
710710
fn nth(&mut self, n: usize) -> Option<Self::Item> {
711711
self.0.nth(n)
712712
}
713+
714+
#[inline]
715+
fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool {
716+
self.0.all(f)
717+
}
718+
719+
#[inline]
720+
fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool {
721+
self.0.any(f)
722+
}
723+
724+
#[inline]
725+
fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where
726+
P: FnMut(&Self::Item) -> bool
727+
{
728+
self.0.find(predicate)
729+
}
730+
731+
#[inline]
732+
fn position<P>(&mut self, predicate: P) -> Option<usize> where
733+
P: FnMut(Self::Item) -> bool
734+
{
735+
self.0.position(predicate)
736+
}
737+
738+
#[inline]
739+
fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
740+
P: FnMut(Self::Item) -> bool
741+
{
742+
self.0.rposition(predicate)
743+
}
713744
}
714745

715746
#[stable(feature = "rust1", since = "1.0.0")]
@@ -718,6 +749,13 @@ impl<'a> DoubleEndedIterator for Bytes<'a> {
718749
fn next_back(&mut self) -> Option<u8> {
719750
self.0.next_back()
720751
}
752+
753+
#[inline]
754+
fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where
755+
P: FnMut(&Self::Item) -> bool
756+
{
757+
self.0.rfind(predicate)
758+
}
721759
}
722760

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

0 commit comments

Comments
 (0)