alloc::str::from_boxed_utf8_unchecked - Rust
Description: API documentation for the Rust `from_boxed_utf8_unchecked` fn in crate `alloc`.
Keywords: rust, rustlang, rust-lang, from_boxed_utf8_unchecked

# 1.20.0[−][src]Function alloc::str::from_boxed_utf8_unchecked

ⓘImportant traits for Box<I>

### Important traits for Box<I>

`impl<I: Iterator + ?Sized> Iterator for Box<I> type Item = I::Item;impl<F: ?Sized + Future + Unpin> Future for Box<F> type Output = F::Output;`

    pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str>

Converts a boxed slice of bytes to a boxed string slice without checking that the string contains valid UTF-8.

# Examples

Basic usage:

    let smile_utf8 = Box::new([226, 152, 186]);
    let smile = unsafe { std::str::from_boxed_utf8_unchecked(smile_utf8) };

    assert_eq!("☺", &*smile);