]> git.lizzy.rs Git - rust.git/commitdiff
Add pathbuf_from_cow_path
authorGeorge Burton <burtonageo@gmail.com>
Fri, 27 Apr 2018 19:41:00 +0000 (20:41 +0100)
committerGeorge Burton <burtonageo@gmail.com>
Fri, 27 Apr 2018 19:41:00 +0000 (20:41 +0100)
src/libstd/path.rs

index 19f38e4d6d9b3e1cad75e86582aac3ffcf8fbbb9..b7ab14b29ca37f79d63a81b414909636e1caeebb 100644 (file)
@@ -1540,6 +1540,14 @@ fn from(p: &'a PathBuf) -> Cow<'a, Path> {
     }
 }
 
+#[stable(feature = "pathbuf_from_cow_path", since = "1.28.0")]
+impl<'a> From<Cow<'a, Path>> for PathBuf {
+    #[inline]
+    fn from(p: Cow<'a, Path>) -> Self {
+        p.into_owned()
+    }
+}
+
 #[stable(feature = "shared_from_slice2", since = "1.24.0")]
 impl From<PathBuf> for Arc<Path> {
     #[inline]