@@ -267,9 +267,11 @@ impl str {
267
267
/// Converts a string slice to a raw pointer.
268
268
///
269
269
/// As string slices are a slice of bytes, the raw pointer points to a
270
- /// `u8`. This pointer will be pointing to the first byte of the string
270
+ /// [ `u8`] . This pointer will be pointing to the first byte of the string
271
271
/// slice.
272
272
///
273
+ /// [`u8`]: primitive.u8.html
274
+ ///
273
275
/// # Examples
274
276
///
275
277
/// Basic usage:
@@ -661,7 +663,7 @@ impl str {
661
663
/// assert_eq!(None, chars.next());
662
664
/// ```
663
665
///
664
- /// Remember, `char`s may not match your human intuition about characters:
666
+ /// Remember, [ `char`] s may not match your human intuition about characters:
665
667
///
666
668
/// ```
667
669
/// let y = "y̆";
@@ -678,16 +680,18 @@ impl str {
678
680
pub fn chars ( & self ) -> Chars {
679
681
core_str:: StrExt :: chars ( self )
680
682
}
681
- /// Returns an iterator over the `char`s of a string slice, and their
683
+ /// Returns an iterator over the [ `char`] s of a string slice, and their
682
684
/// positions.
683
685
///
684
686
/// As a string slice consists of valid UTF-8, we can iterate through a
685
- /// string slice by `char`. This method returns an iterator of both
686
- /// these `char`s, as well as their byte positions.
687
+ /// string slice by [ `char`] . This method returns an iterator of both
688
+ /// these [ `char`] s, as well as their byte positions.
687
689
///
688
- /// The iterator yields tuples. The position is first, the `char` is
690
+ /// The iterator yields tuples. The position is first, the [ `char`] is
689
691
/// second.
690
692
///
693
+ /// [`char`]: primitive.char.html
694
+ ///
691
695
/// # Examples
692
696
///
693
697
/// Basic usage:
@@ -711,7 +715,7 @@ impl str {
711
715
/// assert_eq!(None, char_indices.next());
712
716
/// ```
713
717
///
714
- /// Remember, `char`s may not match your human intuition about characters:
718
+ /// Remember, [ `char`] s may not match your human intuition about characters:
715
719
///
716
720
/// ```
717
721
/// let y = "y̆";
@@ -918,12 +922,13 @@ impl str {
918
922
/// Returns the byte index of the first character of this string slice that
919
923
/// matches the pattern.
920
924
///
921
- /// Returns `None` if the pattern doesn't match.
925
+ /// Returns [ `None`] if the pattern doesn't match.
922
926
///
923
927
/// The pattern can be a `&str`, [`char`], or a closure that determines if
924
928
/// a character matches.
925
929
///
926
930
/// [`char`]: primitive.char.html
931
+ /// [`None`]: option/enum.Option.html#variant.None
927
932
///
928
933
/// # Examples
929
934
///
@@ -962,12 +967,13 @@ impl str {
962
967
/// Returns the byte index of the last character of this string slice that
963
968
/// matches the pattern.
964
969
///
965
- /// Returns `None` if the pattern doesn't match.
970
+ /// Returns [ `None`] if the pattern doesn't match.
966
971
///
967
972
/// The pattern can be a `&str`, [`char`], or a closure that determines if
968
973
/// a character matches.
969
974
///
970
975
/// [`char`]: primitive.char.html
976
+ /// [`None`]: option/enum.Option.html#variant.None
971
977
///
972
978
/// # Examples
973
979
///
@@ -1187,14 +1193,18 @@ impl str {
1187
1193
/// An iterator over substrings of `self`, separated by characters
1188
1194
/// matched by a pattern and yielded in reverse order.
1189
1195
///
1190
- /// The pattern can be a simple `&str`, `char`, or a closure that
1196
+ /// The pattern can be a simple `&str`, [ `char`] , or a closure that
1191
1197
/// determines the split.
1192
1198
/// Additional libraries might provide more complex patterns like
1193
1199
/// regular expressions.
1194
1200
///
1195
- /// Equivalent to `split`, except that the trailing substring is
1201
+ /// [`char`]: primitive.char.html
1202
+ ///
1203
+ /// Equivalent to [`split()`], except that the trailing substring is
1196
1204
/// skipped if empty.
1197
1205
///
1206
+ /// [`split()`]: #method.split
1207
+ ///
1198
1208
/// This method can be used for string data that is _terminated_,
1199
1209
/// rather than _separated_ by a pattern.
1200
1210
///
@@ -1457,7 +1467,7 @@ impl str {
1457
1467
/// # Iterator behavior
1458
1468
///
1459
1469
/// The returned iterator requires that the pattern supports a reverse
1460
- /// search, and it will be a `[ DoubleEndedIterator]` if a forward/reverse
1470
+ /// search, and it will be a [` DoubleEndedIterator`] if a forward/reverse
1461
1471
/// search yields the same elements.
1462
1472
///
1463
1473
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
@@ -1694,9 +1704,11 @@ impl str {
1694
1704
///
1695
1705
/// # Errors
1696
1706
///
1697
- /// Will return `Err` if it's not possible to parse this string slice into
1707
+ /// Will return [ `Err`] if it's not possible to parse this string slice into
1698
1708
/// the desired type.
1699
1709
///
1710
+ /// [`Err`]: str/trait.FromStr.html#associatedtype.Err
1711
+ ///
1700
1712
/// # Example
1701
1713
///
1702
1714
/// Basic usage
@@ -1707,7 +1719,7 @@ impl str {
1707
1719
/// assert_eq!(4, four);
1708
1720
/// ```
1709
1721
///
1710
- /// Using the 'turbofish' instead of annotationg `four`:
1722
+ /// Using the 'turbofish' instead of annotating `four`:
1711
1723
///
1712
1724
/// ```
1713
1725
/// let four = "4".parse::<u32>();
@@ -1765,11 +1777,13 @@ impl str {
1765
1777
result
1766
1778
}
1767
1779
1768
- /// Returns the lowercase equivalent of this string slice, as a new `String`.
1780
+ /// Returns the lowercase equivalent of this string slice, as a new [ `String`] .
1769
1781
///
1770
1782
/// 'Lowercase' is defined according to the terms of the Unicode Derived Core Property
1771
1783
/// `Lowercase`.
1772
1784
///
1785
+ /// [`String`]: string/struct.String.html
1786
+ ///
1773
1787
/// # Examples
1774
1788
///
1775
1789
/// Basic usage:
@@ -1839,11 +1853,13 @@ impl str {
1839
1853
}
1840
1854
}
1841
1855
1842
- /// Returns the uppercase equivalent of this string slice, as a new `String`.
1856
+ /// Returns the uppercase equivalent of this string slice, as a new [ `String`] .
1843
1857
///
1844
1858
/// 'Uppercase' is defined according to the terms of the Unicode Derived Core Property
1845
1859
/// `Uppercase`.
1846
1860
///
1861
+ /// [`String`]: string/struct.String.html
1862
+ ///
1847
1863
/// # Examples
1848
1864
///
1849
1865
/// Basic usage:
@@ -1884,7 +1900,9 @@ impl str {
1884
1900
self . chars ( ) . flat_map ( |c| c. escape_unicode ( ) ) . collect ( )
1885
1901
}
1886
1902
1887
- /// Converts a `Box<str>` into a `String` without copying or allocating.
1903
+ /// Converts a `Box<str>` into a [`String`] without copying or allocating.
1904
+ ///
1905
+ /// [`String`]: string/struct.String.html
1888
1906
///
1889
1907
/// # Examples
1890
1908
///
0 commit comments