Rollup merge of #132398 - krtab:add_doc_link, r=Noratrieb

Add a couple of intra-doc links to str
This commit is contained in:
Matthias Krüger 2024-11-02 08:33:11 +01:00 committed by GitHub
commit ec1cebfcb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -212,7 +212,7 @@ impl str {
} }
} }
/// Finds the closest `x` not exceeding `index` where `is_char_boundary(x)` is `true`. /// Finds the closest `x` not exceeding `index` where [`is_char_boundary(x)`] is `true`.
/// ///
/// This method can help you truncate a string so that it's still valid UTF-8, but doesn't /// This method can help you truncate a string so that it's still valid UTF-8, but doesn't
/// exceed a given number of bytes. Note that this is done purely at the character level /// exceed a given number of bytes. Note that this is done purely at the character level
@ -220,6 +220,8 @@ impl str {
/// split. For example, the emoji 🧑‍🔬 (scientist) could be split so that the string only /// split. For example, the emoji 🧑‍🔬 (scientist) could be split so that the string only
/// includes 🧑 (person) instead. /// includes 🧑 (person) instead.
/// ///
/// [`is_char_boundary(x)`]: Self::is_char_boundary
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -248,7 +250,7 @@ impl str {
} }
} }
/// Finds the closest `x` not below `index` where `is_char_boundary(x)` is `true`. /// Finds the closest `x` not below `index` where [`is_char_boundary(x)`] is `true`.
/// ///
/// If `index` is greater than the length of the string, this returns the length of the string. /// If `index` is greater than the length of the string, this returns the length of the string.
/// ///
@ -256,7 +258,7 @@ impl str {
/// for more details. /// for more details.
/// ///
/// [`floor_char_boundary`]: str::floor_char_boundary /// [`floor_char_boundary`]: str::floor_char_boundary
/// /// [`is_char_boundary(x)`]: Self::is_char_boundary
/// ///
/// # Examples /// # Examples
/// ///
@ -2192,7 +2194,7 @@ impl str {
/// Returns a string slice with the prefix removed. /// Returns a string slice with the prefix removed.
/// ///
/// If the string starts with the pattern `prefix`, returns the substring after the prefix, /// If the string starts with the pattern `prefix`, returns the substring after the prefix,
/// wrapped in `Some`. Unlike `trim_start_matches`, this method removes the prefix exactly once. /// wrapped in `Some`. Unlike [`trim_start_matches`], this method removes the prefix exactly once.
/// ///
/// If the string does not start with `prefix`, returns `None`. /// If the string does not start with `prefix`, returns `None`.
/// ///
@ -2201,6 +2203,7 @@ impl str {
/// ///
/// [`char`]: prim@char /// [`char`]: prim@char
/// [pattern]: self::pattern /// [pattern]: self::pattern
/// [`trim_start_matches`]: Self::trim_start_matches
/// ///
/// # Examples /// # Examples
/// ///
@ -2219,7 +2222,7 @@ impl str {
/// Returns a string slice with the suffix removed. /// Returns a string slice with the suffix removed.
/// ///
/// If the string ends with the pattern `suffix`, returns the substring before the suffix, /// If the string ends with the pattern `suffix`, returns the substring before the suffix,
/// wrapped in `Some`. Unlike `trim_end_matches`, this method removes the suffix exactly once. /// wrapped in `Some`. Unlike [`trim_end_matches`], this method removes the suffix exactly once.
/// ///
/// If the string does not end with `suffix`, returns `None`. /// If the string does not end with `suffix`, returns `None`.
/// ///
@ -2228,6 +2231,7 @@ impl str {
/// ///
/// [`char`]: prim@char /// [`char`]: prim@char
/// [pattern]: self::pattern /// [pattern]: self::pattern
/// [`trim_end_matches`]: Self::trim_end_matches
/// ///
/// # Examples /// # Examples
/// ///