From db2f308a46fe4e66311ed7d05f2b4f7597c6a7b3 Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Mon, 20 Apr 2015 20:45:02 -0500 Subject: Add two examples for Path::new --- src/libstd/path.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 1ad1508ae2d..c5646e014eb 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1248,6 +1248,13 @@ impl Path { /// use std::path::Path; /// /// Path::new("foo.txt"); + /// + /// // Strings work too + /// let s = String::from("bar.txt"); + /// let p = Path::new(&s); + /// + /// // As do other Paths + /// Path::new(&p); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new + ?Sized>(s: &S) -> &Path { -- cgit 1.4.1-3-g733a5 From e178495a5e3db9b8dcafce1ec9bbac4906bb92ad Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Mon, 20 Apr 2015 21:01:13 -0500 Subject: Address some nits --- src/libstd/path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/path.rs b/src/libstd/path.rs index c5646e014eb..b4a359080d7 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1249,11 +1249,11 @@ impl Path { /// /// Path::new("foo.txt"); /// - /// // Strings work too + /// // Strings work too: /// let s = String::from("bar.txt"); /// let p = Path::new(&s); /// - /// // As do other Paths + /// // As do other `Path`s: /// Path::new(&p); /// ``` #[stable(feature = "rust1", since = "1.0.0")] -- cgit 1.4.1-3-g733a5 From ba4d55d130f9577eddf577b9bf99562a8c65857b Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Tue, 21 Apr 2015 01:15:51 -0500 Subject: Separate code into two code blocks --- src/libstd/path.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/path.rs b/src/libstd/path.rs index b4a359080d7..0a13c77018f 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1248,12 +1248,13 @@ impl Path { /// use std::path::Path; /// /// Path::new("foo.txt"); + /// ``` + /// + /// You can create `Path`s from `String`s, or even other `Path`s: /// - /// // Strings work too: + /// ``` /// let s = String::from("bar.txt"); /// let p = Path::new(&s); - /// - /// // As do other `Path`s: /// Path::new(&p); /// ``` #[stable(feature = "rust1", since = "1.0.0")] -- cgit 1.4.1-3-g733a5 From 3e67b6bb6c5383674f58a637f93d6740bca6a7d7 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 25 Apr 2015 22:33:19 +0530 Subject: add import (fixup #24649) --- src/libstd/path.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/path.rs b/src/libstd/path.rs index a52a3dbbef9..2ceb60cc3aa 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1245,6 +1245,8 @@ impl Path { /// 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); -- cgit 1.4.1-3-g733a5