]> git.lizzy.rs Git - rust.git/commitdiff
Impl AsRef<Path> for Cow<OsStr>
authorGleb Kozyrev <gleb@gkoz.com>
Thu, 18 Feb 2016 14:04:28 +0000 (16:04 +0200)
committerGleb Kozyrev <gleb@gkoz.com>
Thu, 18 Feb 2016 14:04:28 +0000 (16:04 +0200)
src/libstd/path.rs

index 10ecaed3aefd6b6db9c771eba0da51e1ed753763..97edb35e5b6d40c11d19759a77f5f864eeec5edd 100644 (file)
@@ -2002,6 +2002,13 @@ fn as_ref(&self) -> &Path {
     }
 }
 
+#[stable(feature = "cow_os_str_as_ref_path", since = "1.8.0")]
+impl<'a> AsRef<Path> for Cow<'a, OsStr> {
+    fn as_ref(&self) -> &Path {
+        Path::new(self)
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl AsRef<Path> for OsString {
     fn as_ref(&self) -> &Path {