Skip to content

Commit

Permalink
Add intra-doc link in str::xxx_char_boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
krtab committed Oct 31, 2024
1 parent 93839e7 commit f0634f0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,16 @@ 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
/// exceed a given number of bytes. Note that this is done purely at the character level
/// and can still visually split graphemes, even though the underlying characters aren't
/// split. For example, the emoji 🧑‍🔬 (scientist) could be split so that the string only
/// includes 🧑 (person) instead.
///
/// [`is_char_boundary(x)`]: Self::is_char_boundary
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -247,15 +249,15 @@ 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.
///
/// This method is the natural complement to [`floor_char_boundary`]. See that method
/// for more details.
///
/// [`floor_char_boundary`]: str::floor_char_boundary
///
/// [`is_char_boundary(x)`]: Self::is_char_boundary
///
/// # Examples
///
Expand Down

0 comments on commit f0634f0

Please sign in to comment.