Skip to content

Commit 9a7b789

Browse files
committed
Add doc example for OsStr::to_os_string.
1 parent 6f10e2f commit 9a7b789

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libstd/ffi/os_str.rs

+10
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,16 @@ impl OsStr {
398398
/// Copies the slice into an owned [`OsString`].
399399
///
400400
/// [`OsString`]: struct.OsString.html
401+
///
402+
/// # Examples
403+
///
404+
/// ```
405+
/// use std::ffi::{OsStr, OsString};
406+
///
407+
/// let os_str = OsStr::new("foo");
408+
/// let os_string = os_str.to_os_string();
409+
/// assert_eq!(os_string, OsString::from("foo"));
410+
/// ```
401411
#[stable(feature = "rust1", since = "1.0.0")]
402412
pub fn to_os_string(&self) -> OsString {
403413
OsString { inner: self.inner.to_owned() }

0 commit comments

Comments
 (0)