We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 83263b4 + ba4d55d commit 4f1bbc2Copy full SHA for 4f1bbc2
src/libstd/path.rs
@@ -1241,6 +1241,14 @@ impl Path {
1241
///
1242
/// Path::new("foo.txt");
1243
/// ```
1244
+ ///
1245
+ /// You can create `Path`s from `String`s, or even other `Path`s:
1246
1247
+ /// ```
1248
+ /// let s = String::from("bar.txt");
1249
+ /// let p = Path::new(&s);
1250
+ /// Path::new(&p);
1251
1252
#[stable(feature = "rust1", since = "1.0.0")]
1253
pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
1254
unsafe { mem::transmute(s.as_ref()) }
0 commit comments