Skip to content

Commit

Permalink
Add doc example for OsString::into_boxed_os_str.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Mar 14, 2017
1 parent bda57db commit 6adbbfc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libstd/ffi/os_str.rs
Expand Up @@ -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()) }
Expand Down

0 comments on commit 6adbbfc

Please sign in to comment.