diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-03-12 15:04:32 -0400 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2017-03-14 09:28:30 -0400 |
| commit | 9a7b789c3717146ca3ce3fca1eb23fa3a239f0fb (patch) | |
| tree | 8f43445e45e7bbb73f2b25075c7ea1dc0aa7b596 /src/libstd | |
| parent | 6f10e2f63de720468e2b4bfcb275e4b90b1f9870 (diff) | |
| download | rust-9a7b789c3717146ca3ce3fca1eb23fa3a239f0fb.tar.gz rust-9a7b789c3717146ca3ce3fca1eb23fa3a239f0fb.zip | |
Add doc example for `OsStr::to_os_string`.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 41bdd9c51d4..3914f398961 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -398,6 +398,16 @@ impl OsStr { /// Copies the slice into an owned [`OsString`]. /// /// [`OsString`]: struct.OsString.html + /// + /// # Examples + /// + /// ``` + /// use std::ffi::{OsStr, OsString}; + /// + /// let os_str = OsStr::new("foo"); + /// let os_string = os_str.to_os_string(); + /// assert_eq!(os_string, OsString::from("foo")); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn to_os_string(&self) -> OsString { OsString { inner: self.inner.to_owned() } |
