@@ -6,6 +6,8 @@ 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`].
10
+ ///
9
11
/// A string slice ([`&str`]) is made of bytes ([`u8`]), and a byte slice
10
12
/// ([`&[u8]`][byteslice]) is made of bytes, so this function converts between
11
13
/// the two. Not all byte slices are valid string slices, however: [`&str`] requires
@@ -97,6 +99,8 @@ 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
+ ///
100
104
/// # Examples
101
105
///
102
106
/// Basic usage:
@@ -142,6 +146,8 @@ pub const fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
142
146
/// Converts a slice of bytes to a string slice without checking
143
147
/// that the string contains valid UTF-8.
144
148
///
149
+ /// This is an alias to [`str::from_utf8_unchecked`].
150
+ ///
145
151
/// See the safe version, [`from_utf8`], for more information.
146
152
///
147
153
/// # Safety
@@ -178,6 +184,8 @@ pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
178
184
/// Converts a slice of bytes to a string slice without checking
179
185
/// that the string contains valid UTF-8; mutable version.
180
186
///
187
+ /// This is an alias to [`str::from_utf8_unchecked_mut`].
188
+ ///
181
189
/// See the immutable version, [`from_utf8_unchecked()`] for documentation and safety requirements.
182
190
///
183
191
/// # Examples
0 commit comments