We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d318148 + 8adf50d commit a7183cfCopy full SHA for a7183cf
src/libcore/str/mod.rs
@@ -413,6 +413,19 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
413
/// See the immutable version, [`from_utf8_unchecked()`][fromutf8], for more information.
414
///
415
/// [fromutf8]: fn.from_utf8_unchecked.html
416
+///
417
+/// # Examples
418
419
+/// Basic usage:
420
421
+/// ```
422
+/// use std::str;
423
424
+/// let mut heart = vec![240, 159, 146, 150];
425
+/// let heart = unsafe { str::from_utf8_unchecked_mut(&mut heart) };
426
427
+/// assert_eq!("💖", heart);
428
429
#[inline]
430
#[stable(feature = "str_mut_extras", since = "1.20.0")]
431
pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
0 commit comments