about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-04-25 21:18:47 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-04-25 21:18:47 +0530
commit4f1bbc209fbf79ed5143ec4f5d78333dab4ba39d (patch)
tree6b8dba52b3bc719227b01f3da37e1c875495c906
parent83263b48c39ef0e21cc9872191f4ce4877f4e05f (diff)
parentba4d55d130f9577eddf577b9bf99562a8c65857b (diff)
downloadrust-4f1bbc209fbf79ed5143ec4f5d78333dab4ba39d.tar.gz
rust-4f1bbc209fbf79ed5143ec4f5d78333dab4ba39d.zip
Rollup merge of #24649 - nham:path_new_examples, r=steveklabnik
-rw-r--r--src/libstd/path.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index e8052041aeb..a52a3dbbef9 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1241,6 +1241,14 @@ impl Path {
     ///
     /// Path::new("foo.txt");
     /// ```
+    ///
+    /// You can create `Path`s from `String`s, or even other `Path`s:
+    ///
+    /// ```
+    /// 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()) }