Skip to content

Commit

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

0 comments on commit 9a7b789

Please sign in to comment.