]> git.lizzy.rs Git - rust.git/commitdiff
Add doc example for `OsString::into_boxed_os_str`.
authorCorey Farwell <coreyf@rwell.org>
Sun, 12 Mar 2017 20:22:29 +0000 (16:22 -0400)
committerCorey Farwell <coreyf@rwell.org>
Tue, 14 Mar 2017 13:30:18 +0000 (09:30 -0400)
src/libstd/ffi/os_str.rs

index 9da6eca34086e01a879acdeef4096439f224ef57..b0f79f9a395a67a7584269764c23aeca77b04c64 100644 (file)
@@ -248,6 +248,18 @@ pub fn shrink_to_fit(&mut self) {
     }
 
     /// 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()) }