Skip to content

Commit db2f308

Browse files
author
Nick Hamann
committed
Add two examples for Path::new
1 parent f46c4e1 commit db2f308

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libstd/path.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,13 @@ impl Path {
12481248
/// use std::path::Path;
12491249
///
12501250
/// Path::new("foo.txt");
1251+
///
1252+
/// // Strings work too
1253+
/// let s = String::from("bar.txt");
1254+
/// let p = Path::new(&s);
1255+
///
1256+
/// // As do other Paths
1257+
/// Path::new(&p);
12511258
/// ```
12521259
#[stable(feature = "rust1", since = "1.0.0")]
12531260
pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {

0 commit comments

Comments
 (0)