diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2017-07-05 20:21:29 +0200 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-07-13 12:35:39 -0700 |
| commit | b90e5107c0e460486f5e3992d92907c3a038e6fc (patch) | |
| tree | 9a2078f5a56f193b1e7b0636a60695f5dc864386 /src/libcore/str | |
| parent | b2c0707872082c890f332178f59fd02eea5b98f3 (diff) | |
Forward more Iterator methods for str::Bytes
These are overridden by slice::Iter
Diffstat (limited to 'src/libcore/str')
| -rw-r--r-- | src/libcore/str/mod.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 624c3638df5..3862b4a2eb0 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -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")] @@ -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")] |
