about summary refs log tree commit diff
path: root/src/libstd/ffi
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-03-12 16:22:29 -0400
committerCorey Farwell <coreyf@rwell.org>2017-03-14 09:30:18 -0400
commit6adbbfc6ba8786ea91e1051ea14d64a91839f5b5 (patch)
tree81bd4ea257bb69a4d82aec3fa422526d8e070db9 /src/libstd/ffi
parentbda57dbc059a15222173b40a5e4d7e5579adcfec (diff)
downloadrust-6adbbfc6ba8786ea91e1051ea14d64a91839f5b5.tar.gz
rust-6adbbfc6ba8786ea91e1051ea14d64a91839f5b5.zip
Add doc example for `OsString::into_boxed_os_str`.
Diffstat (limited to 'src/libstd/ffi')
-rw-r--r--src/libstd/ffi/os_str.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 9da6eca3408..b0f79f9a395 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -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()) }