Add doc example for `OsString::into_boxed_os_str`.

This commit is contained in:
Corey Farwell 2017-03-12 16:22:29 -04:00
parent bda57dbc05
commit 6adbbfc6ba
1 changed files with 12 additions and 0 deletions

View File

@ -248,6 +248,18 @@ impl OsString {
}
/// Converts this `OsString` into a boxed `OsStr`.
///
/// # Examples
///
/// ```
/// #![feature(into_boxed_os_str)]
///
/// use std::ffi::{OsString, OsStr};
///
/// let s = OsString::from("hello");
///
/// let b: Box<OsStr> = s.into_boxed_os_str();
/// ```
#[unstable(feature = "into_boxed_os_str", issue = "0")]
pub fn into_boxed_os_str(self) -> Box<OsStr> {
unsafe { mem::transmute(self.inner.into_box()) }