diff options
Diffstat (limited to 'src/libstd/path.rs')
| -rw-r--r-- | src/libstd/path.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index e8052041aeb..2ceb60cc3aa 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1241,6 +1241,16 @@ impl Path { /// /// Path::new("foo.txt"); /// ``` + /// + /// You can create `Path`s from `String`s, or even other `Path`s: + /// + /// ``` + /// use std::path::Path; + /// + /// let s = String::from("bar.txt"); + /// let p = Path::new(&s); + /// Path::new(&p); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path { unsafe { mem::transmute(s.as_ref()) } |
