Skip to content

Commit 6e8cf93

Browse files
committed
core: Add each, each_char to str::extensions
1 parent 8641c95 commit 6e8cf93

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: src/libcore/str.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,12 @@ impl extensions for str {
17611761
#[doc = "Returns true if one string contains another"]
17621762
#[inline]
17631763
fn contains(needle: str) -> bool { contains(self, needle) }
1764+
#[doc = "Iterate over the bytes in a string"]
1765+
#[inline]
1766+
fn each(it: fn(u8) -> bool) { each(self, it) }
1767+
#[doc = "Iterate over the chars in a string"]
1768+
#[inline]
1769+
fn each_char(it: fn(char) -> bool) { each_char(self, it) }
17641770
#[doc = "Returns true if one string ends with another"]
17651771
#[inline]
17661772
fn ends_with(needle: str) -> bool { ends_with(self, needle) }

0 commit comments

Comments
 (0)