@@ -6,6 +6,7 @@ use crate::{mem, ptr};
6
6
7
7
/// Converts a slice of bytes to a string slice.
8
8
///
9
+ /// This is an alias to [`<str>::from_utf8`].
9
10
/// A string slice ([`&str`]) is made of bytes ([`u8`]), and a byte slice
10
11
/// ([`&[u8]`][byteslice]) is made of bytes, so this function converts between
11
12
/// the two. Not all byte slices are valid string slices, however: [`&str`] requires
@@ -14,6 +15,7 @@ use crate::{mem, ptr};
14
15
///
15
16
/// [`&str`]: str
16
17
/// [byteslice]: slice
18
+ /// [`<str>::from_utf8`]: ../../std/primitive.str.html#method.from_utf8
17
19
///
18
20
/// If you are sure that the byte slice is valid UTF-8, and you don't want to
19
21
/// incur the overhead of the validity check, there is an unsafe version of
@@ -97,6 +99,10 @@ pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
97
99
98
100
/// Converts a mutable slice of bytes to a mutable string slice.
99
101
///
102
+ /// This is an alias to [`<str>::from_utf8_mut`].
103
+ ///
104
+ /// [`<str>::from_utf8_mut`]: ../../std/primitive.str.html#method.from_utf8_mut
105
+ ///
100
106
/// # Examples
101
107
///
102
108
/// Basic usage:
@@ -142,6 +148,10 @@ pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
142
148
/// Converts a slice of bytes to a string slice without checking
143
149
/// that the string contains valid UTF-8.
144
150
///
151
+ /// This is an alias to [`<str>::from_utf8_unchecked`].
152
+ ///
153
+ /// [`<str>::from_utf8_unchecked`]: ../../std/primitive.str.html#method.from_utf8_unchecked
154
+ ///
145
155
/// See the safe version, [`from_utf8`], for more information.
146
156
///
147
157
/// # Safety
@@ -178,6 +188,10 @@ pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
178
188
/// Converts a slice of bytes to a string slice without checking
179
189
/// that the string contains valid UTF-8; mutable version.
180
190
///
191
+ /// This is an alias to [`<str>::from_utf8_unchecked_mut`].
192
+ ///
193
+ /// [`<str>::from_utf8_unchecked_mut`]: ../../std/primitive.str.html#method.from_utf8_unchecked_mut
194
+ ///
181
195
/// See the immutable version, [`from_utf8_unchecked()`] for documentation and safety requirements.
182
196
///
183
197
/// # Examples
0 commit comments