Skip to content

Commit 75b1957

Browse files
authored
update split docs
Some confusion about split popped up at https://news.ycombinator.com/item?id=19080931 since the docs sorta sound like `&str`, `char` and closures are the only types that can be patterns. cc @steveklabnik
1 parent 8ae730a commit 75b1957

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/libcore/str/mod.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -2961,8 +2961,8 @@ impl str {
29612961
/// An iterator over substrings of this string slice, separated by
29622962
/// characters matched by a pattern.
29632963
///
2964-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
2965-
/// split.
2964+
/// The pattern can be any type that implements the Pattern trait. Notable
2965+
/// examples are `&str`, [`char`], and closures that determines the split.
29662966
///
29672967
/// # Iterator behavior
29682968
///
@@ -3078,8 +3078,8 @@ impl str {
30783078
/// An iterator over substrings of the given string slice, separated by
30793079
/// characters matched by a pattern and yielded in reverse order.
30803080
///
3081-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
3082-
/// split.
3081+
/// The pattern can be any type that implements the Pattern trait. Notable
3082+
/// examples are `&str`, [`char`], and closures that determines the split.
30833083
///
30843084
/// # Iterator behavior
30853085
///
@@ -3128,8 +3128,8 @@ impl str {
31283128
/// An iterator over substrings of the given string slice, separated by
31293129
/// characters matched by a pattern.
31303130
///
3131-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
3132-
/// split.
3131+
/// The pattern can be any type that implements the Pattern trait. Notable
3132+
/// examples are `&str`, [`char`], and closures that determines the split.
31333133
///
31343134
/// Equivalent to [`split`], except that the trailing substring
31353135
/// is skipped if empty.
@@ -3175,8 +3175,8 @@ impl str {
31753175
/// An iterator over substrings of `self`, separated by characters
31763176
/// matched by a pattern and yielded in reverse order.
31773177
///
3178-
/// The pattern can be a simple `&str`, [`char`], or a closure that
3179-
/// determines the split.
3178+
/// The pattern can be any type that implements the Pattern trait. Notable
3179+
/// examples are `&str`, [`char`], and closures that determines the split.
31803180
/// Additional libraries might provide more complex patterns like
31813181
/// regular expressions.
31823182
///
@@ -3222,8 +3222,8 @@ impl str {
32223222
/// If `n` substrings are returned, the last substring (the `n`th substring)
32233223
/// will contain the remainder of the string.
32243224
///
3225-
/// The pattern can be a `&str`, [`char`], or a closure that determines the
3226-
/// split.
3225+
/// The pattern can be any type that implements the Pattern trait. Notable
3226+
/// examples are `&str`, [`char`], and closures that determines the split.
32273227
///
32283228
/// # Iterator behavior
32293229
///
@@ -3275,8 +3275,8 @@ impl str {
32753275
/// If `n` substrings are returned, the last substring (the `n`th substring)
32763276
/// will contain the remainder of the string.
32773277
///
3278-
/// The pattern can be a `&str`, [`char`], or a closure that
3279-
/// determines the split.
3278+
/// The pattern can be any type that implements the Pattern trait. Notable
3279+
/// examples are `&str`, [`char`], and closures that determines the split.
32803280
///
32813281
/// # Iterator behavior
32823282
///
@@ -3319,8 +3319,8 @@ impl str {
33193319
/// An iterator over the disjoint matches of a pattern within the given string
33203320
/// slice.
33213321
///
3322-
/// The pattern can be a `&str`, [`char`], or a closure that
3323-
/// determines if a character matches.
3322+
/// The pattern can be any type that implements the Pattern trait. Notable
3323+
/// examples are `&str`, [`char`], and closures that determines the split.
33243324
///
33253325
/// # Iterator behavior
33263326
///

0 commit comments

Comments
 (0)