Skip to content

Commit 6adbbfc

Browse files
committed
Add doc example for OsString::into_boxed_os_str.
1 parent bda57db commit 6adbbfc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libstd/ffi/os_str.rs

+12
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,18 @@ impl OsString {
248248
}
249249

250250
/// Converts this `OsString` into a boxed `OsStr`.
251+
///
252+
/// # Examples
253+
///
254+
/// ```
255+
/// #![feature(into_boxed_os_str)]
256+
///
257+
/// use std::ffi::{OsString, OsStr};
258+
///
259+
/// let s = OsString::from("hello");
260+
///
261+
/// let b: Box<OsStr> = s.into_boxed_os_str();
262+
/// ```
251263
#[unstable(feature = "into_boxed_os_str", issue = "0")]
252264
pub fn into_boxed_os_str(self) -> Box<OsStr> {
253265
unsafe { mem::transmute(self.inner.into_box()) }

0 commit comments

Comments
 (0)