@@ -210,11 +210,15 @@ impl Utf8Error {
210
210
211
211
/// Converts a slice of bytes to a string slice.
212
212
///
213
- /// A string slice (`&str`) is made of bytes (`u8`), and a byte slice (`&[u8]`)
214
- /// is made of bytes, so this function converts between the two. Not all byte
215
- /// slices are valid string slices, however: `&str` requires that it is valid
216
- /// UTF-8. `from_utf8()` checks to ensure that the bytes are valid UTF-8, and
217
- /// then does the conversion.
213
+ /// A string slice ([`&str`]) is made of bytes ([`u8`]), and a byte slice
214
+ /// ([`&[u8]`][byteslice]) is made of bytes, so this function converts between
215
+ /// the two. Not all byte slices are valid string slices, however: [`&str`] requires
216
+ /// that it is valid UTF-8. `from_utf8()` checks to ensure that the bytes are valid
217
+ /// UTF-8, and then does the conversion.
218
+ ///
219
+ /// [`&str`]: ../../std/primitive.str.html
220
+ /// [`u8`]: ../../std/primitive.u8.html
221
+ /// [byteslice]: ../../std/primitive.slice.html
218
222
///
219
223
/// If you are sure that the byte slice is valid UTF-8, and you don't want to
220
224
/// incur the overhead of the validity check, there is an unsafe version of
@@ -228,9 +232,12 @@ impl Utf8Error {
228
232
///
229
233
/// [string]: ../../std/string/struct.String.html#method.from_utf8
230
234
///
231
- /// Because you can stack-allocate a `[u8; N]`, and you can take a `&[u8]` of
232
- /// it, this function is one way to have a stack-allocated string. There is
233
- /// an example of this in the examples section below.
235
+ /// Because you can stack-allocate a `[u8; N]`, and you can take a
236
+ /// [`&[u8]`][byteslice] of it, this function is one way to have a
237
+ /// stack-allocated string. There is an example of this in the
238
+ /// examples section below.
239
+ ///
240
+ /// [byteslice]: ../../std/primitive.slice.html
234
241
///
235
242
/// # Errors
236
243
///
0 commit comments